[Haskell-beginners] Why does sequence (map print [1, 2, 3, 4, 5]) produce [(), (), (), (), ()] at the end?

Olumide 50295 at web.de
Wed Feb 3 10:35:17 UTC 2016


On 01/02/2016 17:39, David McBride wrote:
> Note that it has not actually printed them out.

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 [(),(),()]).

> It merely has an array of as yet unexecuted actions.  To print them
> you'd go like sequence (map print) [1,2,3] ...

Erm ... sequence (map print) [1,2,3] returns an error.

- Olumide




More information about the Beginners mailing list