From 70d37dcb8b381ba1b0b0d1f97d2fe99522f387a6 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sun, 19 Sep 2021 22:39:01 +0200 Subject: support for properties that aren't strings apparently i couldn't read or something? --- lib/Util.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/Util.hs') diff --git a/lib/Util.hs b/lib/Util.hs index 42ba960..82d326f 100644 --- a/lib/Util.hs +++ b/lib/Util.hs @@ -9,6 +9,7 @@ module Util where import Data.Aeson as Aeson import Data.Text (Text) import qualified Data.Text as T +import Tiled2 (PropertyValue(..)) -- | haskell's many string types are FUN … showText :: Show a => a -> Text @@ -29,6 +30,11 @@ instance PrettyPrint Aeson.Value where Aeson.String s -> prettyprint s v -> (T.pack . show) v +instance PrettyPrint PropertyValue where + prettyprint = \case + StrProp str -> str + BoolProp bool -> if bool then "true" else "false" + -- | here since Unit is sometimes used as dummy type instance PrettyPrint () where prettyprint _ = error "shouldn't pretty-print Unit" -- cgit v1.2.3