absorbWithSem This function can be used to locally introduce typeclass instances for
Sem. See Polysemy.ConstraintAbsorber.MonadState for an example of how to
use it.
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulepolysemy-zoo-0.8.2.0Haskell2010
absorbWithSem This function can be used to locally introduce typeclass instances for
Sem. See Polysemy.ConstraintAbsorber.MonadState for an example of how to
use it.
KnownSymbol n => Reifies n StringDefined in reflection-2.1.9 · Data.ReflectionKnownNat n => Reifies n IntegerDefined in reflection-2.1.9 · Data.ReflectionReifies Z IntDefined in reflection-2.1.9 · Data.ReflectionReifies n Int => Reifies (D n) IntDefined in reflection-2.1.9 · Data.ReflectionReifies n Int => Reifies (PD n) IntDefined in reflection-2.1.9 · Data.ReflectionReifies n Int => Reifies (SD n) IntDefined in reflection-2.1.9 · Data.ReflectionReifies (StableBox w0 w1 a) (Box b) => Reifies (Stable w0 w1 a) bDefined in reflection-2.1.9 · Data.Reflection(B b0, B b1, B b2, B b3, B b4, B b5, B b6, B b7, w0 ~ W b0 b1 b2 b3, w1 ~ W b4 b5 b6 b7) => Reifies (StableBox w0 w1 a) (Box a)Defined in reflection-2.1.9 · Data.ReflectionThis is the type of entailment.
a :- b is read as a "entails" b.
With this we can actually build a category for Constraint resolution.
e.g.
Because Eq a is a superclass of Ord a, we can show that Ord a
entails Eq a.
Because instance Ord a => Ord [a] exists, we can show that Ord a
entails Ord [a] as well.
This relationship is captured in the :- entailment type here.
Since p :- p and entailment composes, :- forms the arrows of a
Category of constraints. However, Category only became sufficiently
general to support this instance in GHC 7.8, so prior to 7.8 this instance
is unavailable.
But due to the coherence of instance resolution in Haskell, this Category
has some very interesting properties. Notably, in the absence of
IncoherentInstances, this category is "thin", which is to say that
between any two objects (constraints) there is at most one distinguishable
arrow.
This means that for instance, even though there are two ways to derive
Ord a :- Eq [a], the answers from these two paths _must_ by
construction be equal. This is a property that Haskell offers that is
pretty much unique in the space of languages with things they call "type
classes".
What are the two ways?
Well, we can go from Ord a :- Eq a via the
superclass relationship, and then from Eq a :- Eq [a] via the
instance, or we can go from Ord a :- Ord [a] via the instance
then from Ord [a] :- Eq [a] through the superclass relationship
and this diagram by definition must "commute".
Diagrammatically,
Ord a
ins / \ cls
v v
Ord [a] Eq a
cls \ / ins
v v
Eq [a]This safety net ensures that pretty much anything you can write with this library is sensible and can't break any assumptions on the behalf of library authors.
Category (:-)Defined in constraints-0.14.2 · Data.ConstraintPossible since GHC 7.8, when Category was made polykinded.
() :=> Show (a :- b)Defined in constraints-0.14.2 · Data.Constraint() :=> Eq (a :- b)Defined in constraints-0.14.2 · Data.Constraint() :=> Ord (a :- b)Defined in constraints-0.14.2 · Data.Constrainta => HasDict b (a :- b)Defined in constraints-0.14.2 · Data.ConstraintEq (a :- b)Defined in constraints-0.14.2 · Data.ConstraintAssumes IncoherentInstances doesn't exist.
(Typeable p, Typeable q, p => q) => Data (p :- q)Defined in constraints-0.14.2 · Data.ConstraintOrd (a :- b)Defined in constraints-0.14.2 · Data.ConstraintAssumes IncoherentInstances doesn't exist.
Show (a :- b)Defined in constraints-0.14.2 · Data.Constrainta => NFData (a :- b)Defined in constraints-0.14.2 · Data.Constraint() :=> Semigroup (Dict a)Defined in constraints-0.14.2 · Data.Constraint() :=> Show (Dict a)Defined in constraints-0.14.2 · Data.Constraint() :=> Eq (Dict a)Defined in constraints-0.14.2 · Data.Constraint() :=> Ord (Dict a)Defined in constraints-0.14.2 · Data.Constrainta :=> Monoid (Dict a)Defined in constraints-0.14.2 · Data.Constrainta :=> Bounded (Dict a)Defined in constraints-0.14.2 · Data.Constrainta :=> Enum (Dict a)Defined in constraints-0.14.2 · Data.Constrainta :=> Read (Dict a)Defined in constraints-0.14.2 · Data.ConstraintHasDict a (Dict a)Defined in constraints-0.14.2 · Data.Constrainta => Bounded (Dict a)Defined in constraints-0.14.2 · Data.Constrainta => Enum (Dict a)Defined in constraints-0.14.2 · Data.ConstraintEq (Dict a)Defined in constraints-0.14.2 · Data.Constraint(Typeable p, p) => Data (Dict p)Defined in constraints-0.14.2 · Data.ConstraintOrd (Dict a)Defined in constraints-0.14.2 · Data.Constrainta => Read (Dict a)Defined in constraints-0.14.2 · Data.ConstraintShow (Dict a)Defined in constraints-0.14.2 · Data.ConstraintSemigroup (Dict a)Defined in constraints-0.14.2 · Data.Constrainta => Monoid (Dict a)Defined in constraints-0.14.2 · Data.ConstraintNFData (Dict c)Defined in constraints-0.14.2 · Data.Constraintc => Boring (Dict c)Defined in constraints-0.14.2 · Data.ConstraintRecover a value inside a reify context, given a proxy for its reified type.
Proxy is a type that holds no data, but has a phantom parameter of arbitrary type (or even kind). Its use is to provide type information, even though there is no value available of that type (or it may be too costly to create one).
Historically, Proxy :: Proxy a is a safer alternative to the
undefined :: a idiom.
Proxy :: Proxy (Void, Int -> Int)Proxy
Proxy can even hold types of higher kinds,
Proxy :: Proxy EitherProxy
Proxy :: Proxy FunctorProxy
Proxy :: Proxy complicatedStructureProxy
Generic1 ProxyDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsMonad ProxyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyFunctor ProxyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyApplicative ProxyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyFoldable ProxyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableTraversable ProxyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.TraversableAlternative ProxyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyMonadPlus ProxyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyMonadZip ProxyDefined in base-4.20.2.0 · Control.Monad.ZipEq1 ProxyDefined in base-4.20.2.0 · Data.Functor.ClassesOrd1 ProxyDefined in base-4.20.2.0 · Data.Functor.ClassesRead1 ProxyDefined in base-4.20.2.0 · Data.Functor.ClassesShow1 ProxyDefined in base-4.20.2.0 · Data.Functor.ClassesContravariant ProxyDefined in base-4.20.2.0 · Data.Functor.ContravariantNFData1 ProxyDefined in deepseq-1.5.0.0 · Control.DeepSeqHashable1 ProxyDefined in hashable-1.4.7.0 · Data.Hashable.ClassDecidable ProxyDefined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleDivisible ProxyDefined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleBounded (Proxy t)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyEnum (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyEq (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyData t => Data (Proxy t)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataOrd (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyRead (Proxy t)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyShow (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyIx (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyGeneric (Proxy t)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsSemigroup (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyMonoid (Proxy s)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.ProxyNFData (Proxy a)Defined in deepseq-1.5.0.0 · Control.DeepSeqHashable (Proxy a)Defined in hashable-1.4.7.0 · Data.Hashable.ClassBoring (Proxy a)Defined in boring-0.2.2 · Data.Boringtype Rep (Proxy t) = D1 ('MetaData "Proxy"
"GHC.Internal.Data.Proxy"
"ghc-internal"
'False) (C1 ('MetaCons "Proxy"
'PrefixI 'False) U1)Defined in ghc-internal-9.1003.0 · GHC.Internal.Genericstype Rep1 Proxy = D1 ('MetaData "Proxy"
"GHC.Internal.Data.Proxy"
"ghc-internal"
'False) (C1 ('MetaCons "Proxy"
'PrefixI 'False) U1)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics