Commit dee18f82 authored by Paul Ogris's avatar Paul Ogris
Browse files

Pretty error output

parent 8d3dfef1
...@@ -10,12 +10,11 @@ ...@@ -10,12 +10,11 @@
import Language.LARS import Language.LARS
import Relax import Relax
import Options.Generic import Options.Generic
import qualified Data.Text.IO as T import qualified Data.Text.IO as T
data CLI = CLI newtype CLI = CLI
{ { input :: FilePath <?> "Input file" }
input :: FilePath <?> "Input file" deriving (Show, Generic)
} deriving (Show, Generic)
instance ParseRecord CLI instance ParseRecord CLI
...@@ -25,5 +24,5 @@ main = do ...@@ -25,5 +24,5 @@ main = do
inp <- T.readFile (unHelpful $ input cli) inp <- T.readFile (unHelpful $ input cli)
case parse program (unHelpful $ input cli) inp of case parse program (unHelpful $ input cli) inp of
Left e -> error (show e) Left e -> error (errorBundlePretty e)
Right x -> T.putStrLn $ prettyProgram (relax x) Right x -> T.putStrLn $ prettyProgram (relax x)
...@@ -11,6 +11,7 @@ module Language.LARS ...@@ -11,6 +11,7 @@ module Language.LARS
-- * Pretty Printing -- * Pretty Printing
prettyOneLine, prettyOneLine,
prettyProgram, prettyProgram,
errorBundlePretty,
-- * Parsing -- * Parsing
parse, parse,
......
a(X) :- b(X), not c(X).
b(1). b(2).
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment