ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Core.Predicate

Synopsis

- data Pred
  - = ClassPred Class [Type]
  - | EqPred EqRel Type Type
  - | IrredPred PredType
  - | ForAllPred [TyVar] [PredType] PredType
- classifyPredType :: PredType -> Pred
- isPredTy :: HasDebugCallStack => Type -> Bool
- isEvVarType :: Type -> Bool
- data EqRel
  - = NomEq
  - | ReprEq
- eqRelRole :: EqRel -> Role
- isEqPrimPred :: PredType -> Bool
- isEqPred :: PredType -> Bool
- getEqPredTys :: PredType -> (Type, Type)
- getEqPredTys_maybe :: PredType -> Maybe (Role, Type, Type)
- getEqPredRole :: PredType -> Role
- predTypeEqRel :: PredType -> EqRel
- mkPrimEqPred :: Type -> Type -> Type
- mkReprPrimEqPred :: Type -> Type -> Type
- mkPrimEqPredRole :: Role -> Type -> Type -> PredType
- mkHeteroPrimEqPred :: Kind -> Kind -> Type -> Type -> Type
- mkHeteroReprPrimEqPred :: Kind -> Kind -> Type -> Type -> Type
- mkClassPred :: Class -> [Type] -> PredType
- isDictTy :: Type -> Bool
- typeDeterminesValue :: Type -> Bool
- isClassPred :: PredType -> Bool
- isEqPredClass :: Class -> Bool
- isCTupleClass :: Class -> Bool
- getClassPredTys :: HasDebugCallStack => PredType -> (Class, [Type])
- getClassPredTys_maybe :: PredType -> Maybe (Class, [Type])
- classMethodTy :: Id -> Type
- classMethodInstTy :: Id -> [Type] -> Type
- isIPLikePred :: Type -> Bool
- hasIPSuperClasses :: Class -> [Type] -> Bool
- isIPTyCon :: TyCon -> Bool
- isIPClass :: Class -> Bool
- isCallStackTy :: Type -> Bool
- isCallStackPred :: Class -> [Type] -> Maybe FastString
- isCallStackPredTy :: Type -> Bool
- isIPPred_maybe :: Type -> Maybe (FastString, Type)
- type DictId = EvId
- isEvVar :: Var -> Bool
- isDictId :: Id -> Bool

# 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.
IrredPred PredType | An irreducible predicate.
ForAllPred [TyVar] [PredType] PredType | A quantified predicate. See Note [Quantified constraints] in GHC.Tc.Solver.Canonical

classifyPredType :: PredType -> Pred Source #

isPredTy :: HasDebugCallStack => Type -> Bool Source #

isEvVarType :: Type -> Bool Source #

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 #

eqRelRole :: EqRel -> Role Source #

isEqPrimPred :: PredType -> Bool Source #

isEqPred :: PredType -> Bool Source #

getEqPredTys :: PredType -> (Type, Type) Source #

getEqPredTys_maybe :: PredType -> Maybe (Role, Type, Type) Source #

getEqPredRole :: PredType -> Role Source #

predTypeEqRel :: PredType -> EqRel Source #

Get the equality relation relevant for a pred type.

mkPrimEqPred :: Type -> Type -> Type Source #

Creates a primitive type equality predicate. Invariant: the types are not Coercions

mkReprPrimEqPred :: Type -> Type -> Type Source #

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

Makes a lifted equality predicate at the given role

mkHeteroPrimEqPred :: Kind -> Kind -> Type -> Type -> Type Source #

Creates a primitive type equality predicate with explicit kinds

mkHeteroReprPrimEqPred :: Kind -> Kind -> Type -> Type -> Type Source #

Creates a primitive representational type equality predicate with explicit kinds

mkClassPred :: Class -> [Type] -> PredType Source #

isDictTy :: Type -> Bool Source #

typeDeterminesValue :: Type -> Bool Source #

isClassPred :: PredType -> Bool Source #

isEqPredClass :: Class -> Bool Source #

isCTupleClass :: Class -> Bool Source #

getClassPredTys :: HasDebugCallStack => PredType -> (Class, [Type]) Source #

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

classMethodTy :: Id -> Type Source #

classMethodInstTy :: Id -> [Type] -> Type Source #

isIPLikePred :: Type -> Bool Source #

hasIPSuperClasses :: Class -> [Type] -> Bool Source #

isIPTyCon :: TyCon -> Bool Source #

isIPClass :: Class -> Bool Source #

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.

isCallStackPredTy :: Type -> Bool Source #

isIPPred_maybe :: Type -> Maybe (FastString, 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

isEvVar :: Var -> Bool Source #

isDictId :: Id -> Bool Source #