Kind

ghc-7.8.3: The GHC API

Safe Haskell | None
Language | Haskell98

Kind

Contents

- Main data type
  - Deconstructing Kinds
  - Predicates on Kinds
  - Functions on variables

Synopsis

- type SuperKind = Type
- type Kind = Type
- typeKind :: Type -> Kind
- anyKind :: Kind
- liftedTypeKind :: Kind
- unliftedTypeKind :: Kind
- openTypeKind :: Kind
- constraintKind :: Kind
- mkArrowKind :: Kind -> Kind -> Kind
- mkArrowKinds :: [Kind] -> Kind -> Kind
- anyKindTyCon :: TyCon
- liftedTypeKindTyCon :: TyCon
- openTypeKindTyCon :: TyCon
- unliftedTypeKindTyCon :: TyCon
- constraintKindTyCon :: TyCon
- superKind :: Kind
- superKindTyCon :: TyCon
- pprKind :: Kind -> SDoc
- pprParendKind :: Kind -> SDoc
- kindAppResult :: Kind -> [Type] -> Kind
- synTyConResKind :: TyCon -> Kind
- splitKindFunTys :: Kind -> ([Kind], Kind)
- splitKindFunTysN :: Int -> Kind -> ([Kind], Kind)
- splitKindFunTy_maybe :: Kind -> Maybe (Kind, Kind)
- isLiftedTypeKind :: Kind -> Bool
- isUnliftedTypeKind :: Kind -> Bool
- isOpenTypeKind :: Kind -> Bool
- isConstraintKind :: Kind -> Bool
- isConstraintOrLiftedKind :: Kind -> Bool
- returnsConstraintKind :: Kind -> Bool
- isKind :: Kind -> Bool
- isKindVar :: Var -> Bool
- isSuperKind :: Type -> Bool
- isSuperKindTyCon :: TyCon -> Bool
- isLiftedTypeKindCon :: TyCon -> Bool
- isConstraintKindCon :: TyCon -> Bool
- isAnyKind :: Kind -> Bool
- isAnyKindCon :: TyCon -> Bool
- okArrowArgKind :: Kind -> Bool
- okArrowResultKind :: Kind -> Bool
- isSubOpenTypeKind :: Kind -> Bool
- isSubOpenTypeKindKey :: Unique -> Bool
- isSubKind :: Kind -> Kind -> Bool
- isSubKindCon :: TyCon -> TyCon -> Bool
- tcIsSubKind :: Kind -> Kind -> Bool
- tcIsSubKindCon :: TyCon -> TyCon -> Bool
- defaultKind :: Kind -> Kind
- defaultKind_maybe :: Kind -> Maybe Kind
- kiVarsOfKind :: Kind -> VarSet
- kiVarsOfKinds :: [Kind] -> VarSet

# Main data type

type SuperKind = Type Source

"Super kinds", used to help encode `Kind`s 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)

typeKind :: Type -> Kind Source

anyKind :: Kind Source

See Type for details of the distinction between these `Kind`s

liftedTypeKind :: Kind Source

See Type for details of the distinction between these `Kind`s

unliftedTypeKind :: Kind Source

See Type for details of the distinction between these `Kind`s

openTypeKind :: Kind Source

See Type for details of the distinction between these `Kind`s

constraintKind :: Kind Source

See Type for details of the distinction between these `Kind`s

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 for details of the distinction between the `Kind` `TyCon`s

liftedTypeKindTyCon :: TyCon Source

See Type for details of the distinction between the `Kind` `TyCon`s

openTypeKindTyCon :: TyCon Source

See Type for details of the distinction between the `Kind` `TyCon`s

unliftedTypeKindTyCon :: TyCon Source

See Type for details of the distinction between the `Kind` `TyCon`s

constraintKindTyCon :: TyCon Source

See Type for details of the distinction between the `Kind` `TyCon`s

superKind :: Kind Source

See Type for details of the distinction between these `Kind`s

superKindTyCon :: TyCon Source

See Type for details of the distinction between the `Kind` `TyCon`s

pprKind :: Kind -> SDoc Source

pprParendKind :: Kind -> SDoc Source

## Deconstructing Kinds

kindAppResult :: Kind -> [Type] -> Kind Source

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

splitKindFunTy_maybe :: Kind -> Maybe (Kind, Kind) Source

## Predicates on Kinds

isLiftedTypeKind :: Kind -> Bool Source

isUnliftedTypeKind :: Kind -> Bool Source

See Type for details of the distinction between these `Kind`s

isOpenTypeKind :: Kind -> Bool Source

See Type for details of the distinction between these `Kind`s

isConstraintKind :: Kind -> Bool Source

See Type for details of the distinction between these `Kind`s

isConstraintOrLiftedKind :: Kind -> Bool Source

See Type for details of the distinction between these `Kind`s

returnsConstraintKind :: Kind -> Bool Source

isKind :: Kind -> Bool Source

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

isKindVar :: Var -> Bool Source

isSuperKind :: Type -> Bool Source

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

isSuperKindTyCon :: TyCon -> Bool Source

isLiftedTypeKindCon :: TyCon -> Bool Source

isConstraintKindCon :: TyCon -> Bool Source

isAnyKind :: Kind -> Bool Source

See Type for details of the distinction between these `Kind`s

isAnyKindCon :: TyCon -> Bool Source

okArrowArgKind :: Kind -> Bool Source

okArrowResultKind :: Kind -> Bool Source

isSubOpenTypeKind :: Kind -> Bool Source

True of any sub-kind of OpenTypeKind

isSubOpenTypeKindKey :: Unique -> Bool Source

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`

tcIsSubKind :: Kind -> Kind -> Bool Source

tcIsSubKindCon :: TyCon -> TyCon -> Bool Source

defaultKind :: Kind -> Kind Source

defaultKind_maybe :: Kind -> Maybe Kind Source

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

## Functions on variables

kiVarsOfKind :: Kind -> VarSet Source

kiVarsOfKinds :: [Kind] -> VarSet Source