<div dir="ltr">In ghci, any statement that returns Show a => IO a (that is IO a where the a is showable) will be run in IO and the result a will be shown once it finishes.  If a is not showable it will simply run the IO action, but not show the result.<br><br>> :t sequence (map print [1,2,3])<br>sequence (map print [1,2,3]) :: IO [()]<br>> :i Show<br>instance Show a => Show [a] -- Defined in ‘GHC.Show’<br>instance Show () -- Defined in ‘GHC.Show’<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 3, 2016 at 5:35 AM, Olumide <span dir="ltr"><<a href="mailto:50295@web.de" target="_blank">50295@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 01/02/2016 17:39, David McBride wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Note that it has not actually printed them out.<br>
</blockquote>
<br></span>
I hope you don't mind me asking but why then does sequence (map print [1,2,3] ) return the numbers 1, 2, 3 (albeit followed by [(),(),()]).<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
It merely has an array of as yet unexecuted actions.  To print them<br></span>
you'd go like sequence (map print) [1,2,3] ...<br>
</blockquote>
<br>
Erm ... sequence (map print) [1,2,3] returns an error.<div class="HOEnZb"><div class="h5"><br>
<br>
- Olumide<br>
<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br></div>