summaryrefslogtreecommitdiff
path: root/lib/TiledAbstract.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/TiledAbstract.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/TiledAbstract.hs b/lib/TiledAbstract.hs
index 6d58f46..9fd2df0 100644
--- a/lib/TiledAbstract.hs
+++ b/lib/TiledAbstract.hs
@@ -2,9 +2,8 @@
module TiledAbstract where
-import Data.Maybe (fromMaybe)
-import Data.Proxy (Proxy)
-import Data.Text (Text)
+import Universum
+
import qualified Data.Vector as V
import Tiled (Layer (..), Object (..), Property (..),
PropertyValue (..), Tile (..), Tiledmap (..),
@@ -15,27 +14,27 @@ class HasProperties a where
adjustProperties :: ([Property] -> Maybe [Property]) -> a -> a
instance HasProperties Layer where
- getProperties = fromMaybe mempty . layerProperties
+ getProperties = maybeToMonoid . layerProperties
adjustProperties f layer = layer
{ layerProperties = f (getProperties layer) }
instance HasProperties Tileset where
- getProperties = fromMaybe mempty . tilesetProperties
+ getProperties = maybeToMonoid . tilesetProperties
adjustProperties f tileset = tileset
{ tilesetProperties = f (getProperties tileset) }
instance HasProperties Tile where
- getProperties = V.toList . fromMaybe mempty . tileProperties
+ getProperties = V.toList . maybeToMonoid . tileProperties
adjustProperties f tile = tile
{ tileProperties = (fmap V.fromList . f) (getProperties tile) }
instance HasProperties Object where
- getProperties = V.toList . fromMaybe mempty . objectProperties
+ getProperties = V.toList . maybeToMonoid . objectProperties
adjustProperties f obj = obj
{ objectProperties = (fmap V.fromList . f) (getProperties obj) }
instance HasProperties Tiledmap where
- getProperties = fromMaybe mempty . tiledmapProperties
+ getProperties = maybeToMonoid . tiledmapProperties
adjustProperties f tiledmap = tiledmap
{ tiledmapProperties = f (getProperties tiledmap) }