HORIZON HASKELLDocslts/ghc-10.0.x8174fa42026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Moduleghc-10.0.0.20260917GHC2024

GHC.Core.Predicate

  • 4 types
  • 49 values
datadata EqRel
#

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

Instances3Eq, Ord, Outputable
  • Eq EqRelDefined in ghc-10.0.0.20260917 · GHC.Core.Predicate
  • Ord EqRelDefined in ghc-10.0.0.20260917 · GHC.Core.Predicate
  • Outputable EqRelDefined in ghc-10.0.0.20260917 · GHC.Core.Predicate
valueisEqPred :: PredType -> Bool
#

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

valuepredTypeEqRel :: PredType -> EqRel
#

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

valuemkNomEqPred :: Type -> Type -> Type
#

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

valuemkReprEqPred :: Type -> Type -> Type
#

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

Is the type *guaranteed* to determine the value? Might say No even if the type does determine the value. See Note [Type determines value]

valuemightMentionIP
  1. :: (Type -> Bool)

    predicate on the string

  2. -> (Type -> Bool)

    predicate on the type

  3. -> Class
  4. -> [Type]
  5. -> Bool
#

mightMentionIP str_cond ty_cond cls tys returns True if:

  • cls tys is of the form IP str ty, where str_cond str and ty_cond ty are both True,

  • or any superclass of cls tys has this property.

See Note [Local implicit parameters]

valuedecomposeIPPred :: Type -> (Id, [Type])
#

Take a type (IP sym ty), where IP is the built in IP class and return (ip, MkIP, [sym,ty]), where ip is the class-op for class IP MkIP is the data constructor for class IP

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

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

Well-scoped free variables

9 declarations
valuescopedSort :: [Var] -> [Var]
#

Do a topological sort on a list of tyvars, so that binders occur before occurrences E.g. given [ a::k, k::Type, b::k ] it'll return a well-scoped list [ k::Type, a::k, b::k ].

This is a deterministic sorting operation (that is, doesn't depend on Uniques).

It is also meant to be stable: that is, variables should not be reordered unnecessarily. This is specified in Note [ScopedSort] See also Note [Ordering of implicit variables] in GHC.Rename.HsType

Is a type a canonical LHS? That is, is it a tyvar or an exactly-saturated type family application? Does not look through type synonyms.