Proposal: Add Applicative instances for the remaining monads in base

Paterson, Ross R.Paterson at city.ac.uk
Fri Nov 11 18:05:19 CET 2011


Bas van Dijk writes:
> instance ArrowApply a => Applicative (ArrowMonad a) where
>     pure = return
>     (<*>) = ap

You don't actually need ArrowApply there:

instance Arrow a => Applicative (ArrowMonad a) where
    pure x = ArrowMonad (arr (const x))
    ArrowMonad f <*> ArrowMonad x = ArrowMonad (f &&& x >>> arr (uncurry id))

Of course for this and the Functor instance ArrowMonad is a poor name.


More information about the Libraries mailing list