Proposal #2316: Add Applicative instances for all MTL Monads

This proposal is very straightforward: add Applicative instances for all the Monads in the MTL. Deadline for discussion is two weeks from today, June 12 2008. Cheers, Spencer Janssen

lemming:
On Wed, 28 May 2008, Spencer Janssen wrote:
This proposal is very straightforward: add Applicative instances for all the Monads in the MTL. Deadline for discussion is two weeks from today, June 12
Seems like a no brainer. monadLib already has applicative instances. -- Don

On Wed, 2008-05-28 at 23:53 -0500, Spencer Janssen wrote:
This proposal is very straightforward: add Applicative instances for all the Monads in the MTL. Deadline for discussion is two weeks from today, June 12 2008.
Yes! While we're at it I'm sure there are other monads in the standard libraries that should be in Applicative. QuickCheck 1.x for example iirc. Duncan

Spencer Janssen wrote:
This proposal is very straightforward: add Applicative instances for all the Monads in the MTL.
It's not quite as straightforward as it looks: If you only need an instance (Applicative m) => Applicative (Transformer m), not instance (Monad m) => Applicative (Transformer m), will you use the first one? (I think yes.) -Isaac

On Thu, May 29, 2008 at 06:44:12AM -0400, Isaac Dupree wrote:
Spencer Janssen wrote:
This proposal is very straightforward: add Applicative instances for all the Monads in the MTL.
It's not quite as straightforward as it looks: If you only need an instance (Applicative m) => Applicative (Transformer m), not instance (Monad m) => Applicative (Transformer m), will you use the first one? (I think yes.)
Yes, and ditto for the Functor instances, where possible. Also, Alternative instances for everything that has a MonadPlus instance.

On Thu, May 29, 2008 at 03:58:07PM +0100, Ross Paterson wrote:
On Thu, May 29, 2008 at 06:44:12AM -0400, Isaac Dupree wrote:
Spencer Janssen wrote:
This proposal is very straightforward: add Applicative instances for all the Monads in the MTL.
It's not quite as straightforward as it looks: If you only need an instance (Applicative m) => Applicative (Transformer m), not instance (Monad m) => Applicative (Transformer m), will you use the first one? (I think yes.)
Yes, and ditto for the Functor instances, where possible.
Is it worth sacrificing backwards compatibility? We can't guarantee that all Monads are Functors.
Also, Alternative instances for everything that has a MonadPlus instance.
I will add these. Cheers, Spencer Janssen

On Thu, May 29, 2008 at 06:44:12AM -0400, Isaac Dupree wrote:
Spencer Janssen wrote:
This proposal is very straightforward: add Applicative instances for all the Monads in the MTL.
It's not quite as straightforward as it looks: If you only need an instance (Applicative m) => Applicative (Transformer m), not instance (Monad m) => Applicative (Transformer m), will you use the first one? (I think yes.)
-Isaac
Note that each of the Functor instances for the transformers require (Monad m). Because Functor is a superclass of Applicative, the Applicative instances must also have the (Monad m) constraint. We can change the Functor instances, but it does break backwards compatibility (not all Monads are Functors). Cheers, Spencer Janssen

On Thu, May 29, 2008 at 01:53:26PM -0500, Spencer Janssen wrote:
Note that each of the Functor instances for the transformers require (Monad m). Because Functor is a superclass of Applicative, the Applicative instances must also have the (Monad m) constraint. We can change the Functor instances, but it does break backwards compatibility (not all Monads are Functors).
I think it would be best to change the Functor instances, rather than compounding the problem by repeating it with Applicative and Alternative. Not all Monads are Functors, but they should be, and all the monads in base and built using mtl from those will be.
participants (6)
-
Don Stewart
-
Duncan Coutts
-
Henning Thielemann
-
Isaac Dupree
-
Ross Paterson
-
Spencer Janssen