[Haskell-beginners] Getting a specified number of lines from stdin
Nicolaas du Preez
njdupreez at yahoo.com
Sun Mar 6 10:38:47 UTC 2016
Good day All,
Why does
liftM (take 5) $ sequence $ repeat getLine
not stop at reading only 5 lines from stdin but keeps on reading more?
What I’m really trying to achieve is to get input from the user until
an empty line is read with the code below. But this doesn’t work
as I expected, similar to the above.
liftM (takeWhile (/= "")) $ sequence $ repeat getLine
Regards,
Nicolaas du Preez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160306/056cc31c/attachment.html>
More information about the Beginners
mailing list