haskell-mode icon indicating copy to clipboard operation
haskell-mode copied to clipboard

getLine behaves not correctly in Interactive-Haskell-mode.

Open peterwang opened this issue 12 years ago • 3 comments

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"] :36:1: Not in scope: ‘b’

-- 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?

peterwang avatar Sep 03 '14 20:09 peterwang

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.

Decoherence avatar Sep 09 '14 21:09 Decoherence

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?

ivan-m avatar Sep 10 '14 00:09 ivan-m

Can we reasonable expect that we can fix this particular issue?

gracjan avatar May 21 '15 10:05 gracjan