summaryrefslogtreecommitdiff
path: root/lib/CheckMap.hs
diff options
context:
space:
mode:
authorstuebinm2021-09-23 00:23:03 +0200
committerstuebinm2021-09-23 00:23:03 +0200
commit7ad5e1cd504b1d57ff3660f9eb81d2e7072ea4bf (patch)
treea144113aa8defd68f7b88b1e9ef6ee0196384c55 /lib/CheckMap.hs
parentc6be6366d6411d7b0b53fd8879537a33fefd5a88 (diff)
very naïve handling of directories
Diffstat (limited to '')
-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