Functor hierarchy proposal and class system extension proposal

Isaac Dupree ml at
Wed Jan 5 06:03:14 CET 2011

On 01/04/11 19:48, Ben Millwood wrote:
> There's a fair question in whether we want deviation from the default
> at all (although I think the answer is probably yes). I think it's
> reasonable that any type that is an instance of Monad be forced to
> have ap = (<*>), for example, so really the only reason I can see we'd
> want to be able to override those functions would be for efficiency.

Remember the example
Monad implies Functor (fmap = Control.Monad.liftM)
Traversable implies Functor (fmap = Data.Traversable.fmapDefault)

e.g. [] and Maybe are instances of all these classes.

yes, liftM and fmapDefault probably must *do* the same thing[*], but one 
of those definitions still needs to be picked.

[*probably--I'm haven't convinced myself that it's true in all cases of 
"deepening"-type class hierarchies though--we are here trying to 
engineer to support all cases of "deepening" hierarchies.]


More information about the Haskell-prime mailing list