Hello everyone, I am currently writing a small program in Haskell, using Hugs under Linux to run it. The program works in a conversation mode, a user issues a lot of lengthy commands. However, backspace doesn't work, no matter which function (getContents, getLine) I use, which makes debugging and normal work with the program a nightmare. Does anyone know any workaround (i.e. sensible replacement to getLine) apart from switching to ghc and using the readline library? Wojciech Moczydlowski, Jr
"Wojciech Moczydlowski, Jr"
However, backspace doesn't work, no matter which function(getContents, getLine) I use, which makes debugging and normal work with the program a nightmare. Does anyone know any workaround (i.e. sensible replacement to getLine) apart from switching to ghc and using the readline library?
I recently posted the attached "SimpleLineEditor" module to the Haskell libraries mailing list. To use the module in Hugs, you probably need to run it through cpp before loading it. Then, call initialise :: IO () before reading the terminal, and restore :: IO () afterwards, and the replacement for Prelude.getLine is getLineEdited :: String -> IO (Maybe String) where the string argument is the prompt for the user. Regards, Malcolm
On Fri, Aug 01, 2003 at 11:02:02AM +0100, Malcolm Wallace wrote:
"Wojciech Moczydlowski, Jr"
writes: However, backspace doesn't work, no matter which function(getContents, getLine) I use, which makes debugging and normal work with the program a nightmare. Does anyone know any workaround (i.e. sensible replacement to getLine) apart from switching to ghc and using the readline library?
I recently posted the attached "SimpleLineEditor" module to the Haskell libraries mailing list. To use the module in Hugs, you probably need to run it through cpp before loading it. Then, call initialise :: IO () before reading the terminal, and restore :: IO () afterwards, and the replacement for Prelude.getLine is getLineEdited :: String -> IO (Maybe String) where the string argument is the prompt for the user.
I suspect this won't work, because Hugs singles out stdin for some very wierd treatment (raw mode, with Hugs echoing to stdout, even when it's not the same as stdin). It's horrible, but looks hard to change, because it interacts with a lot of environments.
participants (3)
-
Malcolm Wallace -
Ross Paterson -
Wojciech Moczydlowski, Jr