summaryrefslogtreecommitdiff
path: root/lib/CheckMap.hs
diff options
context:
space:
mode:
authorstuebinm2021-10-28 13:28:55 +0200
committerstuebinm2021-10-30 15:44:25 +0200
commitd2983b867a106ee0581d8dc1d8f413178cdd4027 (patch)
treed2368f38bf580544d8b19e7f3e9dba76630fdebe /lib/CheckMap.hs
parent9e3e10ae5f960d4e544a2792318c3fbf5c44d812 (diff)
make aeson instances agree with themselves
This cleans up all the old rubble that came from the Tiled package I originally took from hackage. It now uses generics instead of implementing all the ToJSON and FromJSON instances by hand, and (deserialize . serialise) will now actually return a (semantically) equivalent json. It'll now also reject keys that it doesn't know, which required adding some in several places which the tiled package didn't know about (or which were introduced after it was originally written, dunno). Several more Maybes are required now, to represent the difference between e.g. empty lists and on set value, which does make the code slightly weirder in other places …
Diffstat (limited to 'lib/CheckMap.hs')
-rw-r--r--lib/CheckMap.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CheckMap.hs b/lib/CheckMap.hs
index 036f4e8..d7d45c0 100644
--- a/lib/CheckMap.hs
+++ b/lib/CheckMap.hs
@@ -23,7 +23,8 @@ import LintWriter (LintResult (..), LintWriter, askContext,
filterLintLevel, lintToDep, resultToDeps,
resultToLints, resultToOffers, runLintWriter)
import Properties (checkLayerProperty, checkMap, checkTileset)
-import Tiled2 (Layer (layerName, layerProperties),
+import Tiled2 (HasProperties (getProperties),
+ Layer (layerName, layerProperties),
LoadResult (..),
Tiledmap (tiledmapLayers, tiledmapTilesets),
Tileset (tilesetName), loadTiledmap)
@@ -96,7 +97,7 @@ runLinter tiledmap depth = MapResult
checkLayer :: LintWriter Layer
checkLayer = do
layer <- askContext
- mapM_ checkLayerProperty (layerProperties layer)
+ mapM_ checkLayerProperty (getProperties layer)
-- human-readable lint output, e.g. for consoles
instance PrettyPrint (Level, MapResult) where