diff options
author | Marvin Borner | 2022-06-18 01:33:20 +0200 |
---|---|---|
committer | Marvin Borner | 2022-06-18 01:33:20 +0200 |
commit | 326fbb6544cce5c1f85b5b2fecae5767dbd9fa32 (patch) | |
tree | bdc4302cdf4f02c9b9c04ad54ab4a6626d5868c4 /src/Eval.hs | |
parent | 3a8e9afd461cf648fc6904df64eb76a3a95eeb99 (diff) |
Switched to Megaparsec
Diffstat (limited to 'src/Eval.hs')
-rw-r--r-- | src/Eval.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Eval.hs b/src/Eval.hs index a5c29bf..e0a36ad 100644 --- a/src/Eval.hs +++ b/src/Eval.hs @@ -15,7 +15,7 @@ import System.Console.Haskeline import System.Environment import System.Exit import System.IO -import Text.Parsec hiding ( State +import Text.Megaparsec hiding ( State , try ) @@ -61,7 +61,7 @@ evalTest exp1 exp2 = eval :: [String] -> Environment -> IO Environment eval [] env = pure env eval (line : ls) env = case parse parseLine "FILE" line of - Left err -> print err >> pure env + Left err -> print (errorBundlePretty err) >> pure env Right instr -> case instr of Define name exp -> let (res, env') = evalDefine name exp `runState` env @@ -116,7 +116,7 @@ evalFunc func env = do -- TODO: Generally improve eval code evalRepl :: String -> Environment -> InputT IO Environment evalRepl line env = case parse parseReplLine "REPL" line of - Left err -> outputStrLn (show err) >> pure env + Left err -> outputStrLn (errorBundlePretty err) >> pure env Right instr -> case instr of Define name exp -> let (res, env') = evalDefine name exp `runState` env |