summaryrefslogtreecommitdiff
path: root/lib/CheckMap.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CheckMap.hs')
-rw-r--r--lib/CheckMap.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/CheckMap.hs b/lib/CheckMap.hs
index c03197c..8d670d5 100644
--- a/lib/CheckMap.hs
+++ b/lib/CheckMap.hs
@@ -5,7 +5,7 @@
{-# LANGUAGE OverloadedStrings #-}
-- | Module that contains the high-level checking functions
-module CheckMap (loadAndLintMap) where
+module CheckMap (loadAndLintMap, MapResult(..)) where
import Data.Aeson (ToJSON)
import Data.Map (Map, fromList, toList)
@@ -27,7 +27,7 @@ import Util (PrettyPrint (prettyprint), prettyprint)
-- | What this linter produces: lints for a single map
-data MapResult a = MapResult
+data MapResult = MapResult
{ mapresultLayer :: Maybe (Map Text (LintResult Layer))
, mapresultGeneral :: [Lint]
, mapresultDepends :: [Dep]
@@ -36,21 +36,21 @@ data MapResult a = MapResult
-- | this module's raison d'ĂȘtre
-loadAndLintMap :: FilePath -> IO (MapResult ())
+loadAndLintMap :: FilePath -> IO MapResult
loadAndLintMap path = loadTiledmap path >>= pure . \case
Left err -> MapResult
{ mapresultLayer = Nothing
, mapresultDepends = []
, mapresultGeneral =
[ hint Fatal . T.pack $
- path <> ": parse error (probably invalid json/not a tiled map): " <> err
+ path <> ": Fatal: " <> err
]
}
Right waMap ->
runLinter waMap
-- | lint a loaded map
-runLinter :: Tiledmap -> MapResult ()
+runLinter :: Tiledmap -> MapResult
runLinter tiledmap = MapResult
{ mapresultLayer = Just layerMap
, mapresultGeneral = generalLints -- no general lints for now
@@ -75,7 +75,7 @@ checkLayer = do
mapM_ checkLayerProperty (layerProperties layer)
-- human-readable lint output, e.g. for consoles
-instance PrettyPrint a => PrettyPrint (MapResult a) where
+instance PrettyPrint MapResult where
prettyprint mapResult = T.concat $ prettyGeneral <> prettyLayer
where
-- TODO: this can be simplified further