ghc-7.2.1: The GHC API




Main data type

type Kind = TypeSource

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)

liftedTypeKind, ubxTupleKind, argTypeKind, openTypeKind, unliftedTypeKind :: KindSource

See Type for details of the distinction between these Kinds

mkArrowKind :: Kind -> Kind -> KindSource

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

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

Iterated application of mkArrowKind

tySuperKind :: SuperKindSource

Deconstructing Kinds

kindFunResult :: Kind -> KindSource

Essentially funResultTy on kinds

synTyConResKind :: TyCon -> KindSource

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)Source

Essentially splitFunTys on kinds

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

Essentially splitFunTysN on kinds

Predicates on Kinds

isUbxTupleKind, isUnliftedTypeKind, isArgTypeKind, isOpenTypeKind :: Kind -> BoolSource

See Type for details of the distinction between these Kinds

isKind :: Kind -> BoolSource

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

isTySuperKind :: SuperKind -> BoolSource

isSuperKind :: Type -> BoolSource

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

isSubArgTypeKind :: Kind -> BoolSource

True of any sub-kind of ArgTypeKind

isSubOpenTypeKind :: Kind -> BoolSource

True of any sub-kind of OpenTypeKind (i.e. anything except arrow)

isSubKind :: Kind -> Kind -> BoolSource

k1 `isSubKind` k2 checks that k1 <: k2

defaultKind :: Kind -> KindSource

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

isSubKindCon :: TyCon -> TyCon -> BoolSource

kc1 `isSubKindCon` kc2 checks that kc1 <: kc2