diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-25 13:25:18 +0000 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-25 13:25:18 +0000 |
| commit | 9d9bad89241bfa14255361dd8452ad40291a9684 (patch) | |
| tree | 5e0f940724f060fb732c36e81217b10c5eb69229 /server/src/Thermoprint/Server/Printer | |
| parent | 09f4d0431ef3015653b6b78f1d413454519380bd (diff) | |
| download | thermoprint-9d9bad89241bfa14255361dd8452ad40291a9684.tar thermoprint-9d9bad89241bfa14255361dd8452ad40291a9684.tar.gz thermoprint-9d9bad89241bfa14255361dd8452ad40291a9684.tar.bz2 thermoprint-9d9bad89241bfa14255361dd8452ad40291a9684.tar.xz thermoprint-9d9bad89241bfa14255361dd8452ad40291a9684.zip | |
Cleaned up printer declaration
Diffstat (limited to 'server/src/Thermoprint/Server/Printer')
| -rw-r--r-- | server/src/Thermoprint/Server/Printer/Debug.hs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/server/src/Thermoprint/Server/Printer/Debug.hs b/server/src/Thermoprint/Server/Printer/Debug.hs index b8c1430..721ec84 100644 --- a/server/src/Thermoprint/Server/Printer/Debug.hs +++ b/server/src/Thermoprint/Server/Printer/Debug.hs | |||
| @@ -1,11 +1,8 @@ | |||
| 1 | {-# LANGUAGE OverloadedStrings #-} | 1 | {-# LANGUAGE OverloadedStrings #-} |
| 2 | {-# LANGUAGE RankNTypes #-} | ||
| 3 | {-# LANGUAGE TemplateHaskell #-} | 2 | {-# LANGUAGE TemplateHaskell #-} |
| 4 | {-# LANGUAGE MultiParamTypeClasses #-} | ||
| 5 | {-# LANGUAGE FlexibleInstances #-} | ||
| 6 | 3 | ||
| 7 | module Thermoprint.Server.Printer.Debug | 4 | module Thermoprint.Server.Printer.Debug |
| 8 | ( Debug(..) | 5 | ( debugPrint |
| 9 | ) where | 6 | ) where |
| 10 | 7 | ||
| 11 | import Control.Monad.IO.Class | 8 | import Control.Monad.IO.Class |
| @@ -24,13 +21,8 @@ import Data.List (intersperse) | |||
| 24 | import Data.Foldable (toList) | 21 | import Data.Foldable (toList) |
| 25 | import Data.Monoid | 22 | import Data.Monoid |
| 26 | 23 | ||
| 27 | data Debug = Debug | 24 | debugPrint :: PrinterMethod |
| 28 | 25 | debugPrint = PM $ (>> return Nothing) . $(logDebugS) "Printer.Debug" . T.pack . show . cotext' | |
| 29 | instance Applicative m => IsPrinter Debug m where | ||
| 30 | printMethod _ = printMethod debugPrinter | ||
| 31 | |||
| 32 | debugPrinter :: PrinterMethod | ||
| 33 | debugPrinter = PM $ (>> return Nothing) . $(logDebugS) "Printer.Debug" . T.pack . show . cotext' | ||
| 34 | 26 | ||
| 35 | cotext' :: Printout -> Text | 27 | cotext' :: Printout -> Text |
| 36 | cotext' = mconcat . intersperse "\n\n" . map (mconcat . map cotext'' . toList) . toList | 28 | cotext' = mconcat . intersperse "\n\n" . map (mconcat . map cotext'' . toList) . toList |
