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.Tc.Validity

  • 2 types
  • 16 values
datadata UserTypeCtxt
#
Instances1Eq
valuecheckFamPatBinders
  1. :: TyCon
  2. -> [TcTyVar]

    Bound on LHS of family instance

  3. -> TyVarSet

    non-user-written tyvars

  4. -> [TcType]

    LHS patterns

  5. -> TcType

    RHS

  6. -> TcM ()
#

Check binders for a type or data family declaration.

Specifically, this function checks for:

  • type variables used on the RHS but not bound (explicitly or implicitly) in the LHS,

  • variables bound by a forall in the LHS but not used in the RHS.

See Note [Check type family instance binders].

valuecheckValidTyFamEqn
  1. :: TyCon

    of the type family

  2. -> [Type]

    Type patterns

  3. -> Type

    Rhs

  4. -> TcM ()
#

Do validity checks on a type family equation, including consistency with any enclosing class instance head, termination, and lack of polytypes.

See also the separate checkFamPatBinders which performs scoping checks on a type family equation. (It's separate because it expects TyFamEqnValidityInfo, which comes from a separate place e.g. for associated type defaults.)

valuecheckValidAssocTyFamDeflt
  1. :: TyCon

    of the type family

  2. -> [Type]

    Type patterns

  3. -> TcM ()
#

Checks that an associated type family default:

  1. Only consists of arguments that are bare type variables, and

  2. Has a distinct type variable in each argument.

See Note [Type-checking default assoc decls] in GHC.Tc.TyCl.