diff options
Diffstat (limited to 'lambda-calcul/haskell/src/Minilang/REPL/IO.hs')
| -rw-r--r-- | lambda-calcul/haskell/src/Minilang/REPL/IO.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lambda-calcul/haskell/src/Minilang/REPL/IO.hs b/lambda-calcul/haskell/src/Minilang/REPL/IO.hs index 90b1e5d..ad6d52b 100644 --- a/lambda-calcul/haskell/src/Minilang/REPL/IO.hs +++ b/lambda-calcul/haskell/src/Minilang/REPL/IO.hs @@ -11,6 +11,7 @@ import Data.Text.IO as Text import Minilang.REPL.Types import System.IO (Handle, hFlush) import System.IO.Error (isEOFError) +import Minilang.REPL.Pure (render) data IOEnv = IOEnv { inputHandle :: Handle, @@ -23,7 +24,7 @@ newtype CONSOLE m a = CONSOLE {runConsole :: StateT IOEnv m a} instance MonadREPL (CONSOLE IO) where input = get >>= lift . (\h -> (interpret <$> hGetLine h) `catch` \(isEOFError -> True) -> pure EOF) . inputHandle - output a = get >>= lift . flip hPutStrLn (pack $ show a) . outputHandle + output a = get >>= lift . flip hPutStrLn (render a) . outputHandle prompt = get >>= lift . (\h -> hPutStr h "λΠ> " >> hFlush h) . outputHandle getEnv = get >>= pure . repl setEnv e' = modify $ \e -> e {repl = e'} |
