
24 Jun
2008
24 Jun
'08
8:22 p.m.
On Tue, Jun 24, 2008 at 11:14:41AM +0100, Malcolm Wallace wrote:
Some datatypes have several different possible implementations of Applicative, for instance, they may be either lazy or strict. The PolyParse library relies crucially on the fact that the Monad and Applicative instances for the Parser type have different strictness behaviours.
I think you're abusing the class, and it's bound to go wrong sooner or later. A monad is morally an applicative functor, and clients ought to be able to assume, as the docs say, that pure = return and (<*>) = ap. The lazy and strict things should be different types.