|
|
# Kind Annotations
|
|
|
|
|
|
|
|
|
## Brief explanation
|
|
|
|
|
|
|
|
|
|
|
|
In Haskell 98, each type constructor and variable has a kind.
|
|
|
Though the Report uses a notation for kinds, they do not appear in Haskell source.
|
|
|
|
|
|
|
|
|
|
|
|
GHC permits types and new type constructors and variables to be annotated with a kind signature, e.g.
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
type T (f :: * -> *) = f Int
|
|
|
```
|
|
|
|
|
|
## References
|
|
|
|
|
|
|
|
|
- [ Kinds](http://www.haskell.org/onlinereport/decls.html#sect4.1.1) in the Haskell 98 report
|
|
|
- [ Explicitly-kinded quantification](http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#sec-kinding) in the GHC User's Guide
|
|
|
|
|
|
## Tickets
|
|
|
|
|
|
|
|
|
|
|
|
<table><tr><th>[\#84](https://gitlab.haskell.org//haskell/prime/issues/84)</th>
|
|
|
<td>Kind Annotations</td></tr></table>
|
|
|
|
|
|
|
|
|
|
|
|
## Pros
|
|
|
|
|
|
|
|
|
- Allows more machine-checked documentation.
|
|
|
- Haskell 98 defaults kinds to `*`, which is a nuisance if you want a higher kind.
|
|
|
Kind annotations remove the need for awkward workarounds like dummy data constructors.
|
|
|
See [KindInference](kind-inference) for alternative solutions to this problem.
|
|
|
|
|
|
## Cons
|
|
|
|
|
|
|
|
|
- con
|
|
|
|
|
|
## Proposal
|
|
|
|
|
|
|
|
|
|
|
|
To adopt explicit kind annotations as part of the language, more or less exactly as GHC permits.
|
|
|
|
|
|
|