Thanks, I suspected that might be the case but it seemed too simple :-) Cheers, G ------------------ -----Original Message----- From: Thomas Davie <tom.davie@gmail.com> Date: Thu, 19 Aug 2010 11:08:34 To: <Gaius@Gaius.org.UK> Cc: Haskell Beginners List<beginners@haskell.org> Subject: Re: [Haskell-beginners] forM vs mapM 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