summaryrefslogtreecommitdiff
path: root/lib/Util.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Util.hs')
-rw-r--r--lib/Util.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Util.hs b/lib/Util.hs
index 1e5826c..a6c8354 100644
--- a/lib/Util.hs
+++ b/lib/Util.hs
@@ -39,13 +39,14 @@ instance PrettyPrint Aeson.Value where
v -> (T.pack . show) v
instance PrettyPrint t => PrettyPrint (Set t) where
- prettyprint = T.intercalate ", " . fmap prettyprint . S.toList
+ prettyprint = prettyprint . S.toList
instance PrettyPrint PropertyValue where
prettyprint = \case
- StrProp str -> str
- BoolProp bool -> if bool then "true" else "false"
- IntProp int -> showText int
+ StrProp str -> str
+ BoolProp bool -> if bool then "true" else "false"
+ IntProp int -> showText int
+ FloatProp float -> showText float
-- | here since Unit is sometimes used as dummy type
instance PrettyPrint () where
@@ -57,6 +58,9 @@ instance PrettyPrint Layer where
instance PrettyPrint Tileset where
prettyprint = (<>) "tileset " . tilesetName
+instance PrettyPrint a => PrettyPrint [a] where
+ prettyprint = T.intercalate ", " . fmap prettyprint
+
printPretty :: PrettyPrint a => a -> IO ()
printPretty = putStr . T.unpack . prettyprint