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 2283ddc
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Data/Constraint/Extras.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,17 @@ 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'.
class (forall c. (forall a. c a) => ConstraintsFor f c) => ArgDict (f :: k -> Type) where
-- 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 ArgDict (f :: k -> Type) where
-- | Apply @c@ to each possible type @a@ that could appear in a @f a@.
--
-- > ConstraintsFor Show Tag = (Show Int, Show Bool)
Expand Down

0 comments on commit 2283ddc

Please # to comment.