[Haskell-beginners] IO question
Brandon Allbery
allbery.b at gmail.com
Thu Oct 27 21:26:27 CEST 2011
On Thu, Oct 27, 2011 at 10:48, Rustom Mody <rustompmody at gmail.com> wrote:
> Can someone explain what is happening here?
> *Main> getTwoChars
> ab
> ('a','b')
> *Main> getTwoChars
> a
> ('\n','a')
>
The code is doing exactly what it says. getTwoChars reads two characters
--- *not* a line. So the next character waiting to be read is the newline,
which is returned by the next getTwoChars.
This may depend to some extent on the platform, as Unix defaults to a
line-oriented input interface (at the OS level) but Windows to
character-oriented input.
--
brandon s allbery allbery.b at gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20111027/62c64b43/attachment.htm>
More information about the Beginners
mailing list