[Haskell-beginners] IO question

Rustom Mody rustompmody at gmail.com
Thu Oct 27 16:48:44 CEST 2011


I have this from Peyton Jones awkward squad paper

getTwoChars :: IO (Char,Char)
getTwoChars = do
            c1 <- getChar
            c2 <- getChar
            return (c1,c2)

Can someone explain what is happening here?
*Main> getTwoChars
ab
('a','b')
*Main> getTwoChars
a
('\n','a')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20111027/42ef6b50/attachment.htm>


More information about the Beginners mailing list