summaryrefslogtreecommitdiff
path: root/tiled/Data/Tiled
diff options
context:
space:
mode:
Diffstat (limited to 'tiled/Data/Tiled')
-rw-r--r--tiled/Data/Tiled/Abstract.hs6
-rw-r--r--tiled/Data/Tiled/TH.hs15
2 files changed, 18 insertions, 3 deletions
diff --git a/tiled/Data/Tiled/Abstract.hs b/tiled/Data/Tiled/Abstract.hs
index 89c40b4..29e9022 100644
--- a/tiled/Data/Tiled/Abstract.hs
+++ b/tiled/Data/Tiled/Abstract.hs
@@ -4,9 +4,9 @@ module Data.Tiled.Abstract where
import Universum
-import Data.Tiled (GlobalId, Layer (..), Object (..), Property (..),
+import Data.Tiled (GlobalId (..), Layer (..), Object (..), Property (..),
PropertyValue (..), Tile (..), Tiledmap (..),
- Tileset (..), mkTiledId)
+ Tileset (..))
import qualified Data.Vector as V
class HasProperties a where
@@ -81,4 +81,4 @@ instance IsProperty Text where
layerIsEmpty :: HasData a => a -> Bool
layerIsEmpty layer = case getData layer of
Nothing -> True
- Just d -> all ((==) $ mkTiledId 0) d
+ Just d -> all ((==) $ GlobalId 0) d
diff --git a/tiled/Data/Tiled/TH.hs b/tiled/Data/Tiled/TH.hs
new file mode 100644
index 0000000..e0ad0e8
--- /dev/null
+++ b/tiled/Data/Tiled/TH.hs
@@ -0,0 +1,15 @@
+module Data.Tiled.TH where
+
+import Universum
+
+import qualified Data.Aeson.TH as TH
+import Data.Char (toLower)
+
+aesonOptions :: Int -> TH.Options
+aesonOptions l = TH.defaultOptions
+ { TH.omitNothingFields = True
+ , TH.rejectUnknownFields = True
+ -- can't be bothered to do a nicer prefix strip
+ , TH.fieldLabelModifier = drop l . map toLower
+ , TH.sumEncoding = TH.UntaggedValue
+ }