ghc-9.13: The GHC API
Safe HaskellNone
LanguageGHC2021

GHC.Core.Predicate

Synopsis

Documentation

data Pred Source #

A predicate in the solver. The solver tries to prove Wanted predicates from Given ones.

Constructors

ClassPred Class [Type]

A typeclass predicate.

EqPred EqRel Type Type

A type equality predicate, (t1 ~#N t2) or (t1 ~#R t2)

IrredPred PredType

An irreducible predicate.

ForAllPred [TyVar] [PredType] PredType

A quantified predicate.

See Note [Quantified constraints] in GHC.Tc.Solver.Solve

data EqRel Source #

A choice of equality relation. This is separate from the type Role because Phantom does not define a (non-trivial) equality relation.

Constructors

NomEq 
ReprEq 

Instances

Instances details
Outputable EqRel Source # 
Instance details

Defined in GHC.Core.Predicate

Methods

ppr :: EqRel -> SDoc Source #

Eq EqRel Source # 
Instance details

Defined in GHC.Core.Predicate

Methods

(==) :: EqRel -> EqRel -> Bool #

(/=) :: EqRel -> EqRel -> Bool #

Ord EqRel Source # 
Instance details

Defined in GHC.Core.Predicate

Methods

compare :: EqRel -> EqRel -> Ordering #

(<) :: EqRel -> EqRel -> Bool #

(<=) :: EqRel -> EqRel -> Bool #

(>) :: EqRel -> EqRel -> Bool #

(>=) :: EqRel -> EqRel -> Bool #

max :: EqRel -> EqRel -> EqRel #

min :: EqRel -> EqRel -> EqRel #

isCoVarType :: Type -> Bool Source #

Does this type classify a core (unlifted) Coercion? At either role nominal or representational (t1 ~# t2) or (t1 ~R# t2) See Note [Types for coercions, predicates, and evidence] in GHC.Core.TyCo.Rep

predTypeEqRel :: PredType -> EqRel Source #

Get the equality relation relevant for a pred type Returns NomEq for dictionary predicates, etc

mkNomEqPred :: Type -> Type -> Type Source #

Creates a primitive nominal type equality predicate. t1 ~# t2 Invariant: the types are not Coercions

mkReprEqPred :: Type -> Type -> Type Source #

Creates a primitive representational type equality predicate. t1 ~R# t2 Invariant: the types are not Coercions

mkEqPred :: EqRel -> Type -> Type -> PredType Source #

Makes a lifted equality predicate at the given role

mkEqPredRole :: Role -> Type -> Type -> PredType Source #

Makes a lifted equality predicate at the given role

isCallStackTy :: Type -> Bool Source #

Is a type a CallStack?

isCallStackPred :: Class -> [Type] -> Maybe FastString Source #

Is a PredType a CallStack implicit parameter?

If so, return the name of the parameter.

isExceptionContextPred :: Class -> [Type] -> Maybe FastString Source #

Is a PredType an ExceptionContext implicit parameter?

If so, return the name of the parameter.

isIPPred_maybe :: Class -> [Type] -> Maybe (Type, Type) Source #

Decomposes a predicate if it is an implicit parameter. Does not look in superclasses. See also [Local implicit parameters].

type DictId = EvId Source #

Dictionary Identifier