aboutsummaryrefslogtreecommitdiff
path: root/server/src/Thermoprint/Server/Printer/Debug.hs
blob: 81e43a36beffb54604591c435baa27f2df94c44d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{-# LANGUAGE EmptyDataDecls    #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes        #-}

module Thermoprint.Server.Printer.Debug
       ( Debug
       ) where

import Control.Monad.IO.Class
import Control.Monad.Trans.Resource

import Data.Text.Lazy (Text)
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.IO as TL

import Thermoprint.Printout
import Thermoprint.Server.Printer

import Data.List (intersperse)
import Data.Foldable (toList)
import Data.Monoid

data Debug

-- instance IsPrinter Debug where
--   toMethod _ = (>> return Nothing) . liftIO . TL.putStrLn . cotext'

-- cotext' :: Printout -> Text
-- cotext' = mconcat . intersperse "\n\n" . map (mconcat . map cotext'' . toList) . toList
--   where
--     cotext'' (Cooked b) = cotext b
--     cotext'' (Raw _)    = "[Raw]"