
Hi all, Can anyone give me an example of a situation where you would use forM but *not* mapM or vice versa? As far as I can see one is simply a flip of the other. Does forM make any guarantees about order of execution? Thanks, G ------------------

On 19 Aug 2010, at 11:02, Gaius Hammond wrote:
Hi all,
Can anyone give me an example of a situation where you would use forM but *not* mapM or vice versa? As far as I can see one is simply a flip of the other. Does forM make any guarantees about order of execution?
Nope, no extra guarentees, just reverses the argument order. forM can look quite nice if you have a large function that you want to map... forM [someList] lots of large function here ... while mapM can look good if you have a small function... mapM simpleFunction [someList] They're also useful both ways round partially applied. Bob

Thanks, I suspected that might be the case but it seemed too simple :-)
Cheers,
G
------------------
-----Original Message-----
From: Thomas Davie
Hi all,
Can anyone give me an example of a situation where you would use forM but *not* mapM or vice versa? As far as I can see one is simply a flip of the other. Does forM make any guarantees about order of execution?
Nope, no extra guarentees, just reverses the argument order. forM can look quite nice if you have a large function that you want to map... forM [someList] lots of large function here ... while mapM can look good if you have a small function... mapM simpleFunction [someList] They're also useful both ways round partially applied. Bob
participants (2)
-
Gaius Hammond
-
Thomas Davie