Collecting values from Functors?
Graham Klyne
gk@ninebynine.org
Fri, 06 Jun 2003 21:54:57 +0100
At 20:52 06/06/03 +0200, Ralf Hinze wrote:
> > class FunctorM t where
> > fmapM :: Monad m => (a -> m b) -> (t a -> m (t b))
> > fmapM_ :: Monad m => (a -> m b) -> (t a -> m ())
> > fmapM_ f t = fmapM f t >> return ()
>
>The `fmapM' function is also known as a monadic map. It can be
>defined in a generic way for every Haskell data type. It's in
>the library of Generic Haskell (called mapMl):
>
> http://www.cs.uu.nl/research/projects/generic-haskell/
So much to learn! I must try and read it all. One day.
A brief chase of that link didn't show up anything that was obviously about
monadic maps... do you have any more specific links?
>As an aside, gmap and friends won't fit the bill, as they work
>on types rather than functors.
As it happens, I think what I described was based on the type rather than
the Functor (the message subject may have been misleading), because I
didn't actually use the existing fmap definition, but defined a new
function with certain similarities.
#g
-------------------
Graham Klyne
<GK@NineByNine.org>
PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E