GHCi reads from stdin do not handle ^D
stefan@stefans:/tmp$ ghc --interactive
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 6.7.20070402, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package base ... linking ... done.
Prelude> getChar
^D'\EOT'
Prelude> getLine
foo^Dbar
"foo\EOTbar"
Prelude> Leaving GHCi.
stefan@stefans:/tmp$ ghc -e 'getChar' -v0
*** Exception: <stdin>: hGetChar: end of file
stefan@stefans:/tmp$ ghc -e 'getLine' -v0
foobar
"foobar"
stefan@stefans:/tmp$
In the first case I pressed C-d immediately after getChar began waiting, in the second case I pressed it in the middle of the word. In both cases the non-interactive output is that which was expected.
The undesirable GHCi output is confirmed with 6.7.20070402, 6.6, and 6.4.2.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.7 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |