Proposal for template-haskell: Make Q an instance of Applicative

Hello, The Q type: newtype Q a = Q { unQ :: forall m. Quasi m => m a } currently has an instance for Monad and Functor. I would like to propose adding an instance for Applicative as well. Note that this also means that the Quasi class needs to get an Applicative superclass: class (Monad m, Applicative m, Functor m) => Quasi m where ... Discussion period: 2 weeks. Regards, Bas

On Fri, Jul 8, 2011 at 12:56 PM, Bas van Dijk
Hello,
The Q type:
newtype Q a = Q { unQ :: forall m. Quasi m => m a }
currently has an instance for Monad and Functor. I would like to propose adding an instance for Applicative as well. Note that this also means that the Quasi class needs to get an Applicative superclass:
class (Monad m, Applicative m, Functor m) => Quasi m where ...
Discussion period: 2 weeks.
Regards,
Bas
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
+1. But wouldn't it be possible to do this without the Applicative superclass, using the Monad instance? Not saying we *should* do that, I'm in favor of your proposal exactly as-is. Michael

+1 to adding the Applicative and the constraint on Quasi.
On Fri, Jul 8, 2011 at 6:33 AM, Michael Snoyman
On Fri, Jul 8, 2011 at 12:56 PM, Bas van Dijk
wrote: Hello,
The Q type:
newtype Q a = Q { unQ :: forall m. Quasi m => m a }
currently has an instance for Monad and Functor. I would like to propose adding an instance for Applicative as well. Note that this also means that the Quasi class needs to get an Applicative superclass:
class (Monad m, Applicative m, Functor m) => Quasi m where ...
Discussion period: 2 weeks.
Regards,
Bas
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
+1. But wouldn't it be possible to do this without the Applicative superclass, using the Monad instance? Not saying we *should* do that, I'm in favor of your proposal exactly as-is.
Using the Monad constraint only, prevents you from working polymorphically in the Quasi instance while using Applicative combinators. You wind up having to carry around both instances. A burden would be borne by everyone who uses TH, rather than the 2-3 people who write Quasi instances. ;) -Edward

The deadline for this proposal has passed.
Michael Snoyman, Wren ng Thornton and Edward Kmett replied positively.
There were no objections.
I filed a ticket and attached the patches:
http://hackage.haskell.org/trac/ghc/ticket/5349
Thanks,
Bas
On 8 July 2011 11:56, Bas van Dijk
Hello,
The Q type:
newtype Q a = Q { unQ :: forall m. Quasi m => m a }
currently has an instance for Monad and Functor. I would like to propose adding an instance for Applicative as well. Note that this also means that the Quasi class needs to get an Applicative superclass:
class (Monad m, Applicative m, Functor m) => Quasi m where ...
Discussion period: 2 weeks.
Regards,
Bas
participants (3)
-
Bas van Dijk
-
Edward Kmett
-
Michael Snoyman