Difference between revisions of "Kind"

From HaskellWiki
Jump to navigation Jump to search
m (change unboxed to unlifted type)
(add references)
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[http://en.wikipedia.org/wiki/Kind_%28type_theory%29 Wikipedia] says, "In type theory, a '''kind''' is the type of a type constructor or, less commonly, the type of a higher-order type operator. A kind system is essentially a simply typed lambda calculus 'one level up,' endowed with a primitive type, denoted * and called 'type,' which is the kind of any (monomorphic) data type."
+
[http://en.wikipedia.org/wiki/Kind_%28type_theory%29 Wikipedia] says, "In type theory, a '''kind''' is the type of a type constructor or, less commonly, the type of a higher-order type operator. A kind system is essentially a simply typed lambda calculus 'one level up,' endowed with a primitive type, denoted * and called 'type', which is the kind of any (monomorphic) data type."
   
 
Ordinary types have kind <TT>*</TT>. Type constructors have kind <TT>P -> Q</TT>, where <TT>P</TT> and <TT>Q</TT> are kinds. For instance:
 
Ordinary types have kind <TT>*</TT>. Type constructors have kind <TT>P -> Q</TT>, where <TT>P</TT> and <TT>Q</TT> are kinds. For instance:
Line 15: Line 15:
   
 
* [[GHC/Kinds]]
 
* [[GHC/Kinds]]
  +
* [https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Kinds Kinds] on the GHC Commentary
  +
* [https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/TypeType TypeType] on the GHC Commentary
 
* [http://hackage.haskell.org/trac/ghc/wiki/IntermediateTypes#KindsareTypes Kinds ?, ??, # and (#)]
 
* [http://hackage.haskell.org/trac/ghc/wiki/IntermediateTypes#KindsareTypes Kinds ?, ??, # and (#)]
 
* [[Books#Foundations|Pierce, Benjamin. ''Types and Programming Languages'']].
 
* [[Books#Foundations|Pierce, Benjamin. ''Types and Programming Languages'']].

Revision as of 03:52, 14 January 2017

Wikipedia says, "In type theory, a kind is the type of a type constructor or, less commonly, the type of a higher-order type operator. A kind system is essentially a simply typed lambda calculus 'one level up,' endowed with a primitive type, denoted * and called 'type', which is the kind of any (monomorphic) data type."

Ordinary types have kind *. Type constructors have kind P -> Q, where P and Q are kinds. For instance:

Int :: *
Maybe :: * -> *
Maybe Bool :: *
a -> a :: *
[] :: * -> *
(->) :: * -> * -> *

In Haskell 98, * is the only inhabited kind, that is, all values have types of kind *. GHC introduces another inhabited kind, #, for unlifted types.

See also