From c89872d393566ab414301cc84f30b8e8d08900b2 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Wed, 15 Dec 2021 23:06:42 +0100 Subject: suggest setting map meta properties if not given --- lib/Util.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/Util.hs') 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 -- cgit v1.2.3