wiki:QuantifiedConstraints

Quantified constraints

This wiki page summarises the state of play on the idea of allowing quantification in class constraints. For example

data Rose f a = Branch a (f (Rose f a))

instance (Eq a, forall b. (Eq b) => Eq (f b))
       => Eq (Rose f a)
  where ...

The new bit is the forall in the context of the instance declaration.

Here are some resources

  • #2893, a ticket about the idea

Status

Use Keyword = QuantifiedConstraints to ensure that a ticket ends up on these lists.

Open Tickets:

#2256
Incompleteness of type inference: must quantify over implication constraints
#2893
Implement "Quantified constraints" proposal
#8516
Add (->) representation and the Invariant class to GHC.Generics
#9123
Need for higher kinded roles
#13153
Several Traversable instances have an extra fmap
#14317
Solve Coercible constraints over type constructors
#14831
QuantifiedConstraints: Odd superclass constraint
#14832
QuantifiedConstraints: Adding to the context causes failure
#14877
QuantifiedConstraints: Can't deduce `xx' from `(xx => a, xx)'
#14879
QuantifiedConstraints: Big error message + can't substitute (=>) with a class alias
#14883
QuantifiedConstraints don't kick in when used in TypeApplications
#14896
QuantifiedConstraints: GHC does doesn't discharge constraints if they are quantified
#14937
QuantifiedConstraints: Reify implication constraints from terms lacking them
#14943
Make (=>) polykinded (:: k -> k -> Constraint)
#14958
QuantifiedConstraints: Doesn't apply implication for existential?
#14968
QuantifiedConstraints: Can't be RHS of type family instances
#14983
Have custom type errors imply Void
#14995
QuantifiedConstraints: Incorrect pretty printing

Closed Tickets:

#5927
A type-level "implies" constraint on Constraints
#12245
Deriving Data at higher kinds
#14070
Allow ‘unsafe’ deriving strategy, deriving code with ‘unsafeCoerce’
#14733
Won't use (forall xx. f xx) with -XQuantifiedConstraints
#14734
QuantifiedConstraints conflated with impredicative polymorphism?
#14735
GHC Panic with QuantifiedConstraints
#14744
Non-exhaustive patterns in case in GHCi with quantified class contexts
#14748
Infer context for Data instance of (data Foo f = Foo (f Bool) (f Int))
#14799
QuantifiedConstraints: Problems with Typeable
#14822
-XQuantifiedConstraints: Turn term-level entailments (:-) into constraints (=>)
#14833
QuantifiedConstraints: GHC can't deduce (() :: Constraint)?
#14835
QuantifiedConstraints: Can't deduce "(a, b)" from "a" and "b"
#14840
QuantifiedConstraints: Can't define class alias
#14860
QuantifiedConstraints: Can't quantify constraint involving type family
#14861
QuantifiedConstraints: Can't use forall'd variable in context
#14863
QuantifiedConstraints: Can't deduce `c' from `(a, b)' and `a |- b |- c'
#14878
Can't witness transitivity ((.)) of isomorphism of Constraints
#14897
QuantifiedConstraints: Can't print type of quantified constraint
#14942
QuantifiedConstraints: GHC can't infer
#14961
QuantifiedConstraints: introducing classes through equality constraints fails
#14993
QuantifiedConstraints and principal types
#15008
Type synonyms with hidden, determined type variables

Last modified 3 months ago Last modified on Feb 23, 2018 8:48:26 AM