On Wed, Jan 26, 2011 at 5:00 PM, David Menendez <dave@zednenem.com> wrote:
On Wed, Jan 26, 2011 at 3:56 PM, Edward Kmett <ekmett@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 otherThen you no longer have (<*>) = ap.
> 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.
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.