
map :: (a -> b) -> [a] -> [b] print :: Show a => a -> IO () map print :: Show a => [a] -> [IO ()] print takes a showable a and creates a procedure that prints it out (IO ()). So therefore map print causes each element in the array to become a procedure that prints out its element, thus the return value is [IO()]. Note that it has not actually printed them out. It merely has an array of as yet unexecuted actions. To print them you'd go like sequence (map print) [1,2,3], or better yet, sequence_ which returns () instead of [()] On Mon, Feb 1, 2016 at 12:28 PM, Olumide <50295@web.de> wrote:
Hello list,
The question says it all.
BTW, I'm studying LYH and I'm on the chapter on IO. The book offers and explanation but its not very clear -- to me at least.
Thanks,
- Olumide
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners