HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Moduleghc-10.0.0.20260917GHC2024

GHC.Tc.Gen.HsType

Typechecking user-specified MonoTypes

Synopsis

Typecheck the class in a default declaration, checking that:

  • it is indeed a class (not e.g. a type family),

  • that the class expects some invisible arguments followed by a single visible argument.

Like tcHsSigType, but for the ...deriving( C ty1 ty2 ) clause

Returns a class constraint with the last argument missing, and the expected kind of the remaining argument.

E.g.:

class C (a::*) (b::k->k) data T a b = ... deriving( C Int )

This function returns (C, [k], [k, Int], k->k).

Return values are fully zonked

datadata UserTypeCtxt
Instances1Eq

Checks that the return kind in a data declaration's kind signature is permissible. There are three cases:

If dealing with a data, newtype, data instance, or newtype instance declaration, check that the return kind is Type.

If the declaration is a newtype or newtype instance and the UnliftedNewtypes extension is enabled, this check is slightly relaxed so that a return kind of the form TYPE r (for some r) is permitted. See Note [Implementation of UnliftedNewtypes] in GHC.Tc.TyCl.

If dealing with a data family declaration, check that the return kind is either of the form:

  1. TYPE r (for some r), or

  2. k (where k is a bare kind variable; see #12369)

See also Note [Datatype return kinds] in GHC.Tc.TyCl

valuecheckClassKindSig :: Kind -> TcM ()

Checks that the result kind of a class is exactly Constraint, rejecting type synonyms and type families that reduce to Constraint. See #16826.