1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-13 11:23:59 +03:00
mal/haskell/step0_repl.hs

29 lines
457 B
Haskell
Raw Normal View History

import System.IO (hFlush, stdout)
2014-12-24 06:35:48 +03:00
import Readline (readline, load_history)
2014-12-24 06:35:48 +03:00
-- read
mal_read str = str
-- eval
eval ast env = ast
-- print
mal_print exp = exp
-- repl
rep line = mal_print $ eval (mal_read line) ""
repl_loop = do
line <- readline "user> "
case line of
Nothing -> return ()
Just "" -> repl_loop
Just str -> do
putStrLn $ rep str
repl_loop
2014-12-24 06:35:48 +03:00
main = do
load_history
repl_loop