diff options
Diffstat (limited to 'tprint/src/Instances.hs')
-rw-r--r-- | tprint/src/Instances.hs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tprint/src/Instances.hs b/tprint/src/Instances.hs new file mode 100644 index 0000000..cffb8b0 --- /dev/null +++ b/tprint/src/Instances.hs | |||
@@ -0,0 +1,25 @@ | |||
1 | module Instances where | ||
2 | |||
3 | import Data.Text (Text) | ||
4 | import qualified Data.Text as T (unpack) | ||
5 | |||
6 | import Data.Time (UTCTime, formatTime, defaultTimeLocale) | ||
7 | |||
8 | import Text.Show.Pretty (Value, PrettyVal(..), dumpStr) | ||
9 | import qualified Text.Show.Pretty as PShow (Value(..)) | ||
10 | |||
11 | import Thermoprint.Client (Scheme(..), BaseUrl(..), PrinterId(..), JobId(..), DraftId(..), Range(..)) | ||
12 | |||
13 | instance PrettyVal Scheme | ||
14 | instance PrettyVal BaseUrl | ||
15 | instance PrettyVal PrinterId | ||
16 | instance PrettyVal JobId | ||
17 | instance PrettyVal DraftId | ||
18 | instance PrettyVal a => PrettyVal (Range a) | ||
19 | |||
20 | instance PrettyVal UTCTime where | ||
21 | prettyVal = PShow.String . formatTime defaultTimeLocale "%Z %F %X" | ||
22 | |||
23 | instance PrettyVal Text where | ||
24 | prettyVal = prettyVal . T.unpack | ||
25 | |||