
6 Dec
2009
6 Dec
'09
7:04 p.m.
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).