[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-beginners
Subject: Re: [Haskell-beginners] Getting a specified number of lines from stdin
From: Rein Henrichs <rein.henrichs () gmail ! com>
Date: 2016-03-11 21:50:06
Message-ID: CAJp6G8x_AiVg6MBYpcTsNJSn=NFUzUELJCd4x+jWewU7wm70Lg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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@gmail.com>
wrote:
> That is an unnecessary use of unsafeInterleaveIO. The solution is actually
> quite simple:
>
> getLines n = replicateM n getLine
>
[Attachment #5 (text/html)]
<div dir="ltr">Note that replicateM n k = sequence (replicate n k), so this solution \
is equivalent to Henk-Jan van Tuyl's original solution.</div><br><div \
class="gmail_quote"><div dir="ltr">On Fri, Mar 11, 2016 at 1:48 PM Rein Henrichs \
<<a href="mailto:rein.henrichs@gmail.com">rein.henrichs@gmail.com</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">That is an \
unnecessary use of unsafeInterleaveIO. The solution is actually quite \
simple:<div><br></div><div> getLines n = replicateM n \
getLine</div></div></blockquote></div>
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic