repl loopgit add .git add .!
This commit is contained in:
parent
125f82f53a
commit
107f887147
1 changed files with 19 additions and 2 deletions
21
app/Main.hs
21
app/Main.hs
|
@ -1,6 +1,23 @@
|
|||
module Main (main) where
|
||||
|
||||
import Lib
|
||||
import Text.Parsec
|
||||
|
||||
import Lib (exprparser, evaluate)
|
||||
|
||||
import System.IO
|
||||
|
||||
main :: IO ()
|
||||
main = someFunc
|
||||
main = ioLoop
|
||||
|
||||
useResult (Right e) = show . evaluate $ e
|
||||
useResult (Left e) = show e
|
||||
|
||||
ioLoop :: IO ()
|
||||
ioLoop = do done <- isEOF
|
||||
if done
|
||||
then putStrLn "Quit!"
|
||||
else do inp <- getLine
|
||||
let expr = parse exprparser "<stdin>" inp
|
||||
putStrLn . useResult $ expr
|
||||
ioLoop
|
||||
|
||||
|
|
Loading…
Reference in a new issue