diff options
| author | Jan Tuomi <jan.tuomi@valuemotive.com> | 2022-09-23 11:05:28 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-05 14:21:52 +0200 |
| commit | 335ed87f5d672fd6a3de856fef62963c2946318f (patch) | |
| tree | 1c9494ff04d70ac4a39c330dbc5dbb574df1fa0e /app | |
| parent | 11ba54ee5c0f3dfd0c3d62a1943d87426280f84d (diff) | |
Add dumb REPL
Diffstat (limited to 'app')
| -rw-r--r-- | app/Main.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/Main.hs b/app/Main.hs index 3e92547..6115252 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -2,6 +2,7 @@ module Main (main) where import System.Environment import Control.Monad.Except import Control.Monad.Reader +import System.Console.Haskeline import Types import Lib @@ -16,6 +17,16 @@ parseArgs config args = config { configShowHelp = True } rest _ -> config +repl :: InputT IO () +repl = do + minput <- getInputLine "> " + case minput of + Nothing -> return () + Just "exit" -> return () + Just input -> do + outputStrLn $ "Input was: " ++ input + repl + main :: IO () main = do args <- getArgs @@ -44,6 +55,6 @@ main = do case result of Left (LException ex) -> putStrLn $ "Error: " ++ ex Right () -> return () - Nothing -> error "TODO REPL" - + Nothing -> do + runInputT defaultSettings repl return () |
