there's outputStrLn

This commit is contained in:
Mirek Kratochvil 2022-11-15 20:31:02 +01:00
parent e074e454d5
commit fdf96f5a77

View file

@ -33,16 +33,16 @@ interpret = (>> return True) . lex
where where
lex input = do lex input = do
case MP.parse P.lexPrlg "-" input of case MP.parse P.lexPrlg "-" input of
Left bundle -> liftIO $ putStr (MP.errorBundlePretty bundle) Left bundle -> lift . outputStr $ MP.errorBundlePretty bundle
Right toks -> parse toks Right toks -> parse toks
parse toks = do parse toks = do
case MP.parse P.parsePrlg "-" toks of case MP.parse P.parsePrlg "-" toks of
Left bundle -> liftIO $ putStr (MP.errorBundlePretty bundle) Left bundle -> lift . outputStr $ MP.errorBundlePretty bundle
Right asts -> traverse_ shunt asts Right asts -> traverse_ shunt asts
shunt ast = do shunt ast = do
o <- gets ops o <- gets ops
case P.shuntPrlg o ast of case P.shuntPrlg o ast of
Left err -> liftIO $ putStrLn $ "expression parsing: " ++ err Left err -> lift . outputStrLn $ "expression parsing: " ++ err
Right prlg -> intern prlg Right prlg -> intern prlg
intern prlgs = do intern prlgs = do
prlgi <- withStrTable $ \st -> C.internPrlg st prlgs prlgi <- withStrTable $ \st -> C.internPrlg st prlgs
@ -58,11 +58,10 @@ interpret = (>> return True) . lex
execute code execute code
execute code = do execute code = do
res <- I.prove code res <- I.prove code
lift . outputStrLn $
case res of case res of
Left err -> liftIO $ putStrLn err Left err -> err
Right res -> Right res ->
liftIO $
putStrLn $
if res if res
then "yes." then "yes."
else "no proof." else "no proof."