ghc-7.4.1: The GHC API

Safe HaskellSafe-Infered

Kind

Contents

Synopsis

Main data type

type Kind = Type

The key type representing kinds in the compiler. Invariant: a kind is always in one of these forms:

 FunTy k1 k2
 TyConApp PrimTyCon [...]
 TyVar kv   -- (during inference only)
 ForAll ... -- (for top-level coercions)

anyKind, constraintKind, ubxTupleKind, argTypeKind, openTypeKind, unliftedTypeKind, liftedTypeKind :: Kind

See Type for details of the distinction between these Kinds

mkArrowKind :: Kind -> Kind -> Kind

Given two kinds k1 and k2, creates the Kind k1 -> k2

mkArrowKinds :: [Kind] -> Kind -> Kind

Iterated application of mkArrowKind

tySuperKind :: SuperKind

Deconstructing Kinds

kindFunResult :: Kind -> KindOrType -> Kind

Essentially funResultTy on kinds handling pi-types too

synTyConResKind :: TyCon -> Kind

Find the result Kind of a type synonym, after applying it to its arity number of type variables Actually this function works fine on data types too, but they'd always return *, so we never need to ask

splitKindFunTys :: Kind -> ([Kind], Kind)

Essentially splitFunTys on kinds

splitKindFunTysN :: Int -> Kind -> ([Kind], Kind)

Essentially splitFunTysN on kinds

Predicates on Kinds

isKind :: Kind -> Bool

Is this a kind (i.e. a type-of-types)?

isSuperKind :: Type -> Bool

Is this a super-kind (i.e. a type-of-kinds)?

isSubArgTypeKind, tcIsSubArgTypeKind :: Kind -> Bool

True of any sub-kind of ArgTypeKind

isSubOpenTypeKind, tcIsSubOpenTypeKind :: Kind -> Bool

True of any sub-kind of OpenTypeKind

True of any sub-kind of OpenTypeKind

defaultKind :: Kind -> Kind

Used when generalising: default OpenKind and ArgKind to *. See Type for more information on what that means

isSubKindCon :: TyCon -> TyCon -> Bool

kc1 `isSubKindCon` kc2 checks that kc1 <: kc2

Functions on variables

Promotion related functions

promoteType :: Type -> Kind

Promotes a type to a kind. Assumes the argument is promotable.