getLine behaves not correctly in Interactive-Haskell-mode.
for example, the session:
λ> sequence [getLine, getLine] a [hit enter] b [hit enter]
raises an error buffer "HS-Error", which says:
-- Hit `q' to close this window.
["a","a"]
-- To disable popups, customize `haskell-interactive-popup-errors'.
Not sure this is a bug of the "interactive-haskell-mode" OR some kind of strange IO buffering problem?
Experiencing the same issue here on OS X (emacs-24.3 and latest packages). I've had this problem in the past, but not certain of the root cause.
I also thought it could be related to buffering; however got identical results when using hFlush from System.IO.
I then tried a fresh install (removed .emacs & .emacs.d/). Reinstalled packages & configured .emacs based on this guide GitHub.
Here's another example:
main :: IO ()
main = do x <- getLine
y <- getLine
putStrLn $ "You said: " ++ x ++ " " ++ y
And running this in the interactive-haskell buffer:
λ> main
Hello
World
Not in scope: data constructor ‘World’
λ> main
Popup message:
-- Hit `q' to close this window.
You said: Hello Hello
<interactive>:10:1:
-- To disable popups, customize `haskell-interactive-pop\
up-errors'.
I'm relatively new to emacs, so any pointers would be appreciated! Since it was working fine until recently, it could be something silly I'm missing.
This also happens in the newer haskell-process stuff, but in an interesting fashion:
sequence [getLine, getLine]
hi
bye
["hi","hi"]
λ> sequence [getLine, getLine]
Hi
["bye","Hi"]
My completely-uneducated-and-random-guess is that it's an interaction with how Emacs communicates with the process; does anyone happen to have an older version of Emacs to test this with?
Can we reasonable expect that we can fix this particular issue?