Skip to content

ghci-6.10.1 has odd buffering behavior

In ghci-6.10.1:

Prelude> :m +System.IO
Prelude System.IO> hGetBuffering stdin
NoBuffering
Prelude System.IO> getChar
asdf
'a'
Prelude System.IO> sdf

<interactive>:1:0: Not in scope: `sdf'
Prelude System.IO> 

That is, even though stdin is supposed to be unbuffered, getChar doesn't return until '\n' is entered.

The above works correctly in ghci-6.8.3.

Also, manually setting the buffering in ghci-6.10.1 works, but only for the duration of one statement:

Prelude System.IO> hSetBuffering stdin NoBuffering >> getChar
a'a'
Prelude System.IO> getChar
asdf
'a'
Prelude System.IO> sdf

<interactive>:1:0: Not in scope: `sdf'
Prelude System.IO> 
Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system MacOS X
Architecture x86
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information