The FunctorM library

Ross Paterson ross at soi.city.ac.uk
Wed Mar 23 10:51:04 EST 2005


On Wed, Mar 23, 2005 at 09:49:43AM -0000, Simon Marlow wrote:
> Does anyone else have any comments on the suggestions from Iavor and
> Thomas in this thread?  I'm happy to make changes, but only if there's
> a concensus.  The proposals so far seems to be
> 
>   1) add dist method
>   2a) make Functor a superclass of FunctorM
>   2b) make Functor a *sub*class of FunctorM
>   2c) make Functor a subclass of Monad
>   2d) make Functor a superclass of Monad
>   3) rename FunctorM class to ForEach
>   4) rename FunctorM module to Control.Monad.FunctorM(?)
> 
> (1) is easy and not controversial (but is 'dist' the best name?).

fsequence:sequence = fmapM:mapM = fmap:map ?

As long as we remember that it's not always a distributive law (join
law fails, e.g. for []), and fmapM doesn't always define a functor
(doesn't preserve composition of Kleisli arrows).

2a) is needed to provide the default definition

	fmapM f = fsequence . fmap f

2b-d) will break Haskell 98 programs.

The placement in the hierarchy is a bit wierd.  Another possibility
(that you suggested earlier) is Data.Functor.


More information about the Libraries mailing list