
1 Jul
2009
1 Jul
'09
12:48 p.m.
I have an issue with IO actions. At the moment I have the following snippet of code, which works as I expect it to. mapM_ (writeChan ch) . lines =<< hGetContents h That is, it gets each line in the file and writes it to the channel. Previously I had just: writeChan ch =<< hGetContents h but when i readChan this I get the empty string every time. I have two questions: * I'm still a little unsure of why mapM_, sequence and the like are necessary, could someone please explain this, or point me somewhere where I can read up on it? * Why does this problem occur when there is only one action to perform? Cheers / Adam Bergmark