[Haskell-cafe] Re: Tutorial uploaded
john at repetae.net
Thu Dec 22 12:58:51 EST 2005
On Thu, Dec 22, 2005 at 02:02:56PM +0000, Daniel Carrera wrote:
> I had never heard of mapM, or other -M functions. I can't imagine why
> those would be needed. It seems like pointless duplication.
(!!!) then you are missing out. the M functions (and monadic traversal
functions in general) especially when combined with the mtl are some of
the best swiss army knives haskell has to offer.
and it is map that is redundant.
map f xs = runIdentity $ mapM f xs
sequence = mapM id
I have come to think of the monadic forms of these functions as the
'true' versions and the others as just common special cases.
though, not my most common function used from the prelude, it is up
there. and the most commonly used non-trivial function other than
John Meacham - ⑆repetae.net⑆john⑈
More information about the Haskell-Cafe