ghc-7.8.2: The GHC API

Safe HaskellNone
LanguageHaskell98

Kind

Contents

Synopsis

Main data type

type SuperKind = Type Source

"Super kinds", used to help encode Kinds as types. Invariant: a super kind is always of this form:

TyConApp SuperKindTyCon ...

type Kind = Type Source

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 :: Kind Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

liftedTypeKind :: Kind Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

unliftedTypeKind :: Kind Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

openTypeKind :: Kind Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

constraintKind :: Kind Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

mkArrowKind :: Kind -> Kind -> Kind Source

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

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

Iterated application of mkArrowKind

anyKindTyCon :: TyCon Source

See "Type#kind_subtyping" for details of the distinction between the Kind TyCons

liftedTypeKindTyCon :: TyCon Source

See "Type#kind_subtyping" for details of the distinction between the Kind TyCons

openTypeKindTyCon :: TyCon Source

See "Type#kind_subtyping" for details of the distinction between the Kind TyCons

unliftedTypeKindTyCon :: TyCon Source

See "Type#kind_subtyping" for details of the distinction between the Kind TyCons

constraintKindTyCon :: TyCon Source

See "Type#kind_subtyping" for details of the distinction between the Kind TyCons

superKind :: Kind Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

superKindTyCon :: TyCon Source

See "Type#kind_subtyping" for details of the distinction between the Kind TyCons

Deconstructing Kinds

synTyConResKind :: TyCon -> Kind Source

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

isUnliftedTypeKind :: Kind -> Bool Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

isOpenTypeKind :: Kind -> Bool Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

isConstraintKind :: Kind -> Bool Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

isConstraintOrLiftedKind :: Kind -> Bool Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

isKind :: Kind -> Bool Source

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

isSuperKind :: Type -> Bool Source

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

isAnyKind :: Kind -> Bool Source

See "Type#kind_subtyping" for details of the distinction between these Kinds

isSubOpenTypeKind :: Kind -> Bool Source

True of any sub-kind of OpenTypeKind

isSubKind :: Kind -> Kind -> Bool Source

k1 `isSubKind` k2 checks that k1 <: k2 Sub-kinding is extremely simple and does not look under arrrows or type constructors

isSubKindCon :: TyCon -> TyCon -> Bool Source

kc1 `isSubKindCon` kc2 checks that kc1 <: kc2

defaultKind_maybe :: Kind -> Maybe Kind Source

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

Functions on variables