Stacking InputT leads to loss of functionality
- Dominant language
- Haskell
- Stars
- 247
- Forks
- 82
- PR merge metrics
- No merged PRs in 30d
Description
I have started with a n mtl stack `type Forth w a r = ExceptT VMSignal (StateT (VM w a) IO) r` and want to use `haskeline` to provide command line editing to my repl. I've refactored to use `type Forth w a r = CME.ExceptT VMSignal (StateT (VM w a) (InputT IO)) r`.
And functions which previously ran the stack now have calls like
```Haskell
repl :: (ForthType a, Eq a) => VM w a -> ForthStep w a -> IO ()
repl vm initF = do
catchSigint vm
let behaviour = maybe defaultBehavior useFileHandle (inputPort vm)
(r, vm') <- runInputTBehavior behaviour
defaultSettings
(runStateT (runExceptT initF) vm)
:
```
and
```Haskell
fwRefill :: ForthStep w a
fwRefill = do
vm <- getVm
case inputPort vm of
Nothing -> throwError VMNoInput
Just h -> do
-- eof <- liftIO (hIsEOF h)
-- when eof (CME.throwError VMEOF)
trace 2 "REFILL"
line <- runInputTBehavior (useFileHandle h) defaultSettings
$ getInputLine "> "
maybe (throwError VMEOF) (\b -> put (vm { buffer = b })) line
next
```
The program works as before (and the > prompt appears. but I can't scroll back into history and the arrow keys still don't work (you get `> ^[[A` on pushing the up arrow, for example (as before). I don't want to put the InputT on the outside as I'd then have to sprinkle all my code with lifts, which I'd prefer to avoid.
What can I do to get command line editing to function, please?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.