aboutsummaryrefslogtreecommitdiff
path: root/tprint/src/Instances.hs
blob: 7814bbcd21ed350145e42af72b02000f7530fa15 (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
module Instances where

import Data.Text (Text)
import qualified Data.Text as T (unpack)

import Data.Time (UTCTime, formatTime, defaultTimeLocale)

import Text.Show.Pretty (Value, PrettyVal(..), dumpStr)
import qualified Text.Show.Pretty as PShow (Value(..))

import Thermoprint.Client (Scheme(..), BaseUrl(..), PrinterId(..), JobId(..), DraftId(..), Range(..), PrinterStatus(..), JobStatus(..), PrintingError(..), EncodingException(..))

instance PrettyVal Scheme
instance PrettyVal BaseUrl
instance PrettyVal PrinterId
instance PrettyVal JobId
instance PrettyVal DraftId
instance PrettyVal a => PrettyVal (Range a)

instance PrettyVal UTCTime where
  prettyVal = PShow.String . formatTime defaultTimeLocale "%Z %F %X"

instance PrettyVal Text where
  prettyVal = prettyVal . T.unpack

instance PrettyVal PrinterStatus
instance PrettyVal JobStatus
instance PrettyVal PrintingError
instance PrettyVal EncodingException