[Haskell-cafe] ANNOUNCE: error-message

Ross Paterson ross at soi.city.ac.uk
Sun Dec 6 19:04:28 EST 2009

On Sun, Dec 06, 2009 at 03:50:55PM -0500, Brent Yorgey wrote:
> So what we have here, it seems, is a type with at least two reasonable
> Applicative instances, one of which does *not* correspond to a Monad
> instance.  My argument is that it is very strange (I might even go so
> far as to call it a bug) to have a type with an Applicative instance
> and a Monad instance which do not correspond, in the sense that
>   pure  = return
>   (<*>) = ap

There are several of these.  Another is the possible Applicative instance
for lists with

    pure  = repeat
    (<*>) = zipWith id

In these cases we usually make the Applicative instance match the Monad
one and define an equivalent type for each other Applicative instance
(e.g. ZipList in Control.Applicative).

More information about the Haskell-Cafe mailing list