GHC.Core.TyCo.Compare

ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Core.TyCo.Compare

Contents

- Type equality
- Type comparison
- Visiblity comparision

Description

Type equality and comparison

Synopsis

- eqType :: HasCallStack => Type -> Type -> Bool
- eqTypeIgnoringMultiplicity :: Type -> Type -> Bool
- eqTypeX :: HasCallStack => RnEnv2 -> Type -> Type -> Bool
- eqTypes :: [Type] -> [Type] -> Bool
- eqVarBndrs :: HasCallStack => RnEnv2 -> [Var] -> [Var] -> Maybe RnEnv2
- pickyEqType :: Type -> Type -> Bool
- tcEqType :: HasDebugCallStack => Type -> Type -> Bool
- tcEqKind :: HasDebugCallStack => Kind -> Kind -> Bool
- tcEqTypeNoKindCheck :: Type -> Type -> Bool
- tcEqTyConApps :: TyCon -> [Type] -> TyCon -> [Type] -> Bool
- tcEqTyConAppArgs :: [Type] -> [Type] -> Bool
- mayLookIdentical :: Type -> Type -> Bool
- nonDetCmpType :: Type -> Type -> Ordering
- eqForAllVis :: ForAllTyFlag -> ForAllTyFlag -> Bool
- cmpForAllVis :: ForAllTyFlag -> ForAllTyFlag -> Ordering

# Type equality

eqType :: HasCallStack => Type -> Type -> Bool #

Type equality comparing both visible and invisible arguments, expanding synonyms and respecting multiplicities.

eqTypeIgnoringMultiplicity :: Type -> Type -> Bool #

eqTypeX :: HasCallStack => RnEnv2 -> Type -> Type -> Bool #

Compare types with respect to a (presumably) non-empty `RnEnv2`.

eqTypes :: [Type] -> [Type] -> Bool #

Type equality on lists of types, looking through type synonyms

eqVarBndrs :: HasCallStack => RnEnv2 -> [Var] -> [Var] -> Maybe RnEnv2 #

pickyEqType :: Type -> Type -> Bool #

Like `pickyEqTypeVis`, but returns a Bool for convenience

tcEqType :: HasDebugCallStack => Type -> Type -> Bool #

tcEqKind :: HasDebugCallStack => Kind -> Kind -> Bool #

tcEqTypeNoKindCheck :: Type -> Type -> Bool #

Just like `tcEqType`, but will return True for types of different kinds as long as their non-coercion structure is identical.

tcEqTyConApps :: TyCon -> [Type] -> TyCon -> [Type] -> Bool #

Check whether two TyConApps are the same; if the number of arguments are different, just checks the common prefix of arguments.

tcEqTyConAppArgs :: [Type] -> [Type] -> Bool #

mayLookIdentical :: Type -> Type -> Bool #

Returns True if the visible part of the types might look equal, even if they are really unequal (in the invisible bits)

This function is very similar to tc_eq_type but it is much more heuristic. Notably, it is always safe to return True, even with types that might (in truth) be unequal -- this affects error messages only (Originally this test was done by eqType with an extra flag, but the result was hard to understand.)

# Type comparison

nonDetCmpType :: Type -> Type -> Ordering #

# Visiblity comparision

eqForAllVis :: ForAllTyFlag -> ForAllTyFlag -> Bool #

Do these denote the same level of visibility? `Required` arguments are visible, others are not. So this function equates `Specified` and `Inferred`. Used for printing.

cmpForAllVis :: ForAllTyFlag -> ForAllTyFlag -> Ordering #

Do these denote the same level of visibility? `Required` arguments are visible, others are not. So this function equates `Specified` and `Inferred`. Used for printing.