summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorstuebinm2021-09-17 23:50:45 +0200
committerstuebinm2021-09-17 23:50:45 +0200
commitbfe45dc4996537b72436f4041d0ca819aa3444e1 (patch)
tree70e4966273b5447159bf39b4556e02affe911801 /src/Main.hs
parent7a9226d84cf9dde33d0fc3e7852a22c36ab1c39b (diff)
(somewhat) reasonable representation of parse errors
This makes map loading (and parsing) part of the linter, and also makes it return "general lints" and nothing else in case that failed. Possibly a sum type would be nicer here, but I guess it's not really important since everything ends up as json anyways?
Diffstat (limited to '')
-rw-r--r--src/Main.hs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/Main.hs b/src/Main.hs
index f0af6c1..7884cf9 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NamedFieldPuns #-}
@@ -8,14 +9,13 @@ module Main where
import Data.Maybe (fromMaybe)
import WithCli
-import CheckMap (runLinter)
+import CheckMap (loadAndLintMap)
import Data.Aeson (encode)
import Data.Aeson.Encode.Pretty (encodePretty)
import qualified Data.ByteString.Lazy as LB
import qualified Data.ByteString.Lazy.Encoding as LB
import Data.Text.Lazy as T
import System.IO (utf8)
-import Tiled2
-- | the options this cli tool can take
data Options = Options
@@ -39,10 +39,7 @@ main = withCli run
run :: Options -> IO ()
run options = do
- -- TODO: what if parsing fails and we get Left err?
- Right waMap <- loadTiledmap $ fromMaybe "example.json" (inpath options)
-
- let lints = runLinter waMap
+ lints <- loadAndLintMap (fromMaybe "example.json" (inpath options))
if json options
then printLB