Adding Applicative/Functor instances to all Monads in GHC
Bas van Dijk
v.dijk.bas at gmail.com
Thu May 16 16:09:20 CEST 2013
Note that I already did this once as part of:
However, that never got merged.
On 16 May 2013 13:33, David Luposchainsky <dluposchainsky at googlemail.com> wrote:
> Hello everyone,
> I recently went through GHC's source, and discovered there are quite a
> few instances of Monad that don't have Functor or Applicative instances.
> Fixing this is very easy by adding the standard instances (pure = return
> etc.), and will not break code.
> There is one exception to this: Hoopl defines its own (<*>). However,
> since it does not seem to have any packages depend on it otherwise,
> renaming this operator is also easily done (the thing is only used ten
> times or so). I called it (<*|*>) to complement (|*><*|), but naming
> should be the least important issue here.
> Small piece of backstory:
> The idea behind this is making GHC future-proof for changing Applicative
> to be a superclass of Monad. However, I think adding the Applicative
> instances is a good idea regardless of whether this will ever happen, so
> that's the only thing I'm proposing right now.
> Libraries mailing list
> Libraries at haskell.org
More information about the Libraries