Skip to content

Commit

Permalink
Remove quantified constraint superclass
Browse files Browse the repository at this point in the history
It is only allowed with GHC 8.6, and doesn't work very well there I'm
told. https://gitlab.haskell.org/ghc/ghc/-/issues/14860 tracks the
underlying issue.
  • Loading branch information
Ericson2314 committed Dec 12, 2020
1 parent 19f0238 commit 079af12
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Data/Constraint/Extras.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@ import Data.Kind
-- Use 'Data.Constraint.Extras.TH.deriveArgDict' to derive instances
-- of this class.
--
-- The class constraint is there to enforce the law that '@ConstraintsFor@ X'
-- *only* enumerates the indices of '@X@'. In the most general case, all types
-- are possible GADT indices, so we should always be able to '@ConstraintsFor@
-- X' from 'forall a. c a'.
-- One law on this class is:
--
-- > (forall c. (forall a. c a) => ConstraintsFor f c)
--
-- This provides and upper bound for what '@ConstraintsFor@ f c' requires. in
-- the most general case, all types are possible GADT indices, so we should
-- always be able to '@ConstraintsFor@ f c' from 'forall a. c a'. This law
-- could actually be a superclass, if it weren't for the restriction on from
-- GHC 8.8 onward (at the time of writing this) that type families cannot be at
-- the heads of quantified constraints.
class (forall c. (forall a. c a) => ConstraintsFor f c) => ArgDict (f :: k -> Type) where
-- | Apply @c@ to each possible type @a@ that could appear in a @f a@.
--
Expand Down

0 comments on commit 079af12

Please sign in to comment.