Skip to content
Snippets Groups Projects
Unverified Commit 1d2733c2 authored by stuebinm's avatar stuebinm
Browse files

turns out records are just sugar

(and one that contains almost only mempty can be written much shorter
than I thought it could)
parent 69484ee8
No related branches found
No related tags found
No related merge requests found
......@@ -39,9 +39,9 @@ import Util (PrettyPrint (prettyprint), prettyprint)
data MapResult = MapResult
{ mapresultLayer :: Map Hint [Layer]
, mapresultTileset :: Map Hint [Tileset] --Map Text (LintResult Tileset)
, mapresultGeneral :: [Lint]
, mapresultDepends :: [Dep]
, mapresultProvides :: [Text]
, mapresultGeneral :: [Lint]
} deriving (Generic)
instance ToJSON MapResult where
......@@ -67,16 +67,10 @@ instance ToJSON CollectedLints where
-- layers upwards in the file hierarchy
loadAndLintMap :: FilePath -> Int -> IO (Maybe MapResult)
loadAndLintMap path depth = loadTiledmap path >>= pure . \case
DecodeErr err -> Just $ MapResult
{ mapresultLayer = mempty
, mapresultTileset = mempty
, mapresultDepends = []
, mapresultProvides = []
, mapresultGeneral =
DecodeErr err -> Just $ MapResult mempty mempty mempty mempty
[ hint Fatal . T.pack $
path <> ": Fatal: " <> err
]
}
IOErr _ -> Nothing
Loaded waMap ->
Just (runLinter waMap depth)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment