Functor => Pointed => Applicative => Monad
Michael Snoyman
michael at snoyman.com
Mon Nov 29 19:26:37 CET 2010
On Mon, Nov 29, 2010 at 8:19 PM, Felipe Almeida Lessa
<felipe.lessa at gmail.com> wrote:
> On Mon, Nov 29, 2010 at 3:50 PM, Michael Snoyman <michael at snoyman.com> wrote:
>> It would be useful for the Failure typeclass[1]. As-is, we made Monad
>> the superclass just for ease of use, but there could definitely be
>> some non-Monads for which a Failure instance makes sense. I think the
>> one that occurred to me most recently is forms in Yesod, which have an
>> Applicative but not Monad instance.
>
> OP's proposal is to have
>
> class Applicative m => Monad m where ...
>
> so you could just say
>
> class Applicative f => Failure e f where ...
>
> The question is if there is something that is Pointed but not
> Applicative that we would like to be Failure.
That's true for the case of forms, but there is definitely something
appealing about having Pointed separate. I may not be able to think of
an example where I'd want a Failure instance that isn't Applicative,
but you never know ;).
Michael
More information about the Libraries
mailing list