diff --git a/src/Data/Record.hs b/src/Data/Record.hs index 57662d633..891275957 100644 --- a/src/Data/Record.hs +++ b/src/Data/Record.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DataKinds, GADTs, KindSignatures, MultiParamTypeClasses, TypeOperators #-} +{-# LANGUAGE ConstraintKinds, DataKinds, GADTs, KindSignatures, MultiParamTypeClasses, TypeFamilies, TypeOperators #-} module Data.Record where import Data.Functor.Listable @@ -30,6 +30,10 @@ class HasField (fields :: [*]) (field :: *) where getField :: Record fields -> field setField :: Record fields -> field -> Record fields +type family ConstrainAll (toConstraint :: * -> Constraint) (fs :: [*]) :: Constraint where + ConstrainAll toConstraint (f ': fs) = (toConstraint f, ConstrainAll toConstraint fs) + ConstrainAll _ '[] = () + -- Instances