Closed JesterOrNot closed 4 years ago
This behavior is expected. The issue you're running into is a mismatch between actions:
getInputLine "..." :: InputT IO String
callCommand input :: IO ...
The fix is to take advantage of InputT
being a "monad transformer" and lifting callCommand
into InputT IO
it using either lift
or liftIO
. For example:
Just input -> do
lift (callCommand input)
loop
Some references: http://book.realworldhaskell.org/read/monad-transformers.html https://wiki.haskell.org/Monad_Transformers
Now I'm getting
[1 of 1] Compiling Main ( src/main.hs, src/main.o )
src/main.hs:18:20: error:
Variable not in scope: lift :: IO () -> InputT IO a0
|
18 | lift (callCommand input)
| ^^^^
Sorry I'm very new to Haskell (but fortunately not programming)
here is the code https://github.com/JesterOrNot/HaskShell/blob/haskeline/src/main.hs I get this
when trying