[Haskell-beginners] Getting a specified number of lines from stdin

Rein Henrichs rein.henrichs at gmail.com
Fri Mar 11 21:50:06 UTC 2016


Note that replicateM n k = sequence (replicate n k), so this solution is
equivalent to Henk-Jan van Tuyl's original solution.

On Fri, Mar 11, 2016 at 1:48 PM Rein Henrichs <rein.henrichs at gmail.com>
wrote:

> That is an unnecessary use of unsafeInterleaveIO. The solution is actually
> quite simple:
>
>     getLines n = replicateM n getLine
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160311/23d8fb00/attachment.html>


More information about the Beginners mailing list