summaryrefslogtreecommitdiff
path: root/lib/Util.hs
diff options
context:
space:
mode:
authorstuebinm2021-09-20 23:03:56 +0200
committerstuebinm2021-09-20 23:06:56 +0200
commitc6be6366d6411d7b0b53fd8879537a33fefd5a88 (patch)
treeefceb26894fc455c85d7ccfd436a415d8ee69985 /lib/Util.hs
parent42df3cf0eb0c5877ac3320994cadec07619bcd6b (diff)
use PrettyPrinter more
Diffstat (limited to 'lib/Util.hs')
-rw-r--r--lib/Util.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Util.hs b/lib/Util.hs
index 5cf27e3..47ee7f2 100644
--- a/lib/Util.hs
+++ b/lib/Util.hs
@@ -9,7 +9,8 @@ module Util where
import Data.Aeson as Aeson
import Data.Text (Text)
import qualified Data.Text as T
-import Tiled2 (Layer (layerData), PropertyValue (..), mkTiledId)
+import Tiled2 (Layer (layerData), PropertyValue (..), layerName,
+ mkTiledId)
-- | haskell's many string types are FUN …
showText :: Show a => a -> Text
@@ -39,6 +40,9 @@ instance PrettyPrint PropertyValue where
instance PrettyPrint () where
prettyprint _ = error "shouldn't pretty-print Unit"
+instance PrettyPrint Layer where
+ prettyprint = (<>) "layer " . layerName
+
printPretty :: PrettyPrint a => a -> IO ()
printPretty = putStr . T.unpack . prettyprint