[Haskell-cafe] Re: Composing monads
Luke Palmer
lrpalmer at gmail.com
Fri Nov 23 19:02:31 EST 2007
On Nov 23, 2007 6:24 PM, Jules Bean <jules at jellybean.co.uk> wrote:
> ...i.e. I wouldn't be afraid of a lambda in a case like that. IME it's
> moderately common to have to do:
>
> mapM_ (\a -> some stuff >> something_with a >> some stuff) ll
This has terrible endweight. In this imperativesque case, I'd write:
forM_ li $ \a -> do
some stuff
something with a
some stuff
Where forM_ is from Data.Foldable (but is easily written as flip mapM_).
Luke
More information about the Haskell-Cafe
mailing list