Non-exported class constraints in errors

David Feuer david.feuer at
Tue Dec 8 18:50:35 UTC 2015

The latest implementation of Data.Constraint.Forall uses

type family Forall (p :: k -> Constraint) :: Constraint where
  Forall p = Forall_ p
class p (Skolem p) => Forall_ (p :: k -> Constraint)
instance p (Skolem p) => Forall_ (p :: k -> Constraint)

The trouble is that errors relating to Forall are reported with Skolem
verbiage, making them incomprehensible to users -- the Skolem type family
is not exported. It would be nice if GHC could keep track of what led to
the p (Skolem p) constraint, and report that. The sanest idea I've come up
with thus far is a "buck stops here" pragma. When GHC attempts to solve a
constraint so marked, it will hold onto that fact, and report any failures
against that. So

{-# TheBuckStopsHere Forall #-}

would make GHC take note when trying to solve Forall p, and report that it
failed to solve Forall p, rather than that it failed to solve constraints
further down the line.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list