diff options
Diffstat (limited to 'server/src/Thermoprint/Server/Printer/Debug.hs')
| -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 |
