Skip to content

Draft: TH: handle explicit quantification in instances

sheaf requested to merge wip/instd-quantifications into master

This patch adds support for explicitly-written quantification in typeclass instances, such as:

instance forall k (a :: k). C a
deriving instance forall k (a :: k). D a

It does so by adding a field of type Maybe (TyVarBndr ()) to both the InstanceD and StandaloneDerivD constructors of the Template Haskell Dec datatype, and making appropriate use of it to ensure that spliced declarations don't silently drop the user-written quantification.

Edited by sheaf

Merge request reports