From 7ad5e1cd504b1d57ff3660f9eb81d2e7072ea4bf Mon Sep 17 00:00:00 2001 From: stuebinm Date: Thu, 23 Sep 2021 00:23:03 +0200 Subject: very naïve handling of directories --- lib/CheckMap.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/CheckMap.hs') 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 -- cgit v1.2.3