Skip to content

getLine behaves not correctly in Interactive-Haskell-mode. #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
peterwang opened this issue Sep 3, 2014 · 3 comments
Closed

getLine behaves not correctly in Interactive-Haskell-mode. #333

peterwang opened this issue Sep 3, 2014 · 3 comments

Comments

@peterwang
Copy link

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?

@Decoherence
Copy link

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.

@ivan-m
Copy link
Contributor

ivan-m commented Sep 10, 2014

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?

@gracjan
Copy link
Contributor

gracjan commented May 21, 2015

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

@gracjan gracjan closed this as completed Oct 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants