transformers
David Menendez
dave at zednenem.com
Wed Jan 26 23:00:00 CET 2011
On Wed, Jan 26, 2011 at 3:56 PM, Edward Kmett <ekmett at gmail.com> wrote:
> Fair enough.
> These are the observations I have about 'transformers'.
> 2.) The instance for Applicative for MaybeT doesn't really follow the other
> instances for Applicative in transformers.
> instance Applicative m => Applicative (MaybeT m) where
> pure = MaybeT . pure . Just
> f <*> a = MaybeT $ (<*>) <$> runMaybeT f <*> runMaybeT a
> would instead follow the convention that Applicatives depend only on
> Applicatives where possible, as opposed to the current default instance.
> This convention is followed everywhere in transformers except this module.
Then you no longer have (<*>) = ap.
This convention is also not followed for the StateT and ErrorT
transformers for the same reason.
If you want something like MaybeT f whose Applicative instance depends
only on the Applicative instance of f, try Compose f Maybe.
--
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>
More information about the Libraries
mailing list