HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleghc-9.10.3GHC2021

GHC.Core.TyCo.Compare

Type equality and comparison

  • 17 values
  • Packageghc-9.10.3
  • Exports17
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceCompare.hs

Type comparison

15 declarations
valueeqType :: Type -> Type -> Bool
#

Type equality on source types. Does not look through newtypes, PredTypes or type families, but it does look through type synonyms. This first checks that the kinds of the types are equal and then checks whether the types are equal, ignoring casts and coercions. (The kind check is a recursive call, but since all kinds have type Type, there is no need to check the types of kinds.) See also Note [Non-trivial definitional equality] in GHC.Core.TyCo.Rep.

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

Type equality on lists of types, looking through type synonyms but not newtypes.

valuetcEqTyConApps :: 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.

valuemayLookIdentical :: 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 there were one function with an extra flag, but the result was hard to understand.)

Visiblity comparision

2 declarations