Further library additions and REPL updates
This commit is contained in:
14
src/REPL.hs
14
src/REPL.hs
@ -14,15 +14,15 @@ repl env = do
|
||||
putStr "sapling < "
|
||||
hFlush stdout
|
||||
input <- getLine
|
||||
if input == "_:exit"
|
||||
then putStrLn "Goodbye!"
|
||||
else if input == ""
|
||||
then do
|
||||
case input of
|
||||
":_exit" ->
|
||||
putStrLn "Goodbye!"
|
||||
"" -> do
|
||||
putStrLn ""
|
||||
repl env
|
||||
else do
|
||||
_ -> do
|
||||
let clearEnv = Map.delete "__result" env
|
||||
let newEnv = evalSingle clearEnv (parseSingle input)
|
||||
newEnv = evalSingle clearEnv (parseSingle input)
|
||||
case Map.lookup "__result" newEnv of
|
||||
Just r -> do
|
||||
putStrLn $ "sapling > " ++ show r
|
||||
@ -36,4 +36,4 @@ decodeResult tc =
|
||||
Right str -> "\"" ++ str ++ "\""
|
||||
Left _ -> case ofNumber tc of
|
||||
Right num -> "# " ++ show num
|
||||
Left _ -> "Failed to decode number from Tree"
|
||||
Left _ -> ""
|
||||
|
Reference in New Issue
Block a user