I am trying to find an explanation of the DataKinds extension that will make sense to me having come from only having read Learn You a Haskell. Is there a standard source that will make sense to me with what little I've learned?
Edit: For example the documentation says
With -XDataKinds, GHC automatically promotes every suitable datatype to be a kind, and its (value) constructors to be type constructors. The following types
and gives the example
data Nat = Ze | Su Nat
give rise to the following kinds and type constructors:
Nat :: BOX
Ze :: Nat
Su :: Nat -> Nat
I am not getting the point. Although I don't understand what BOX
means, the statements Ze :: Nat
and Su :: Nat -> Nat
seem to state what is already normally the case that Ze and Su are normal data constructors exactly as you would expect to see with ghci
Prelude> :t Su
Su :: Nat -> Nat
S :: Nat -> Nat
is overloaded in that it can refer toS
as a data constructor taking an argument of typeNat
orS
as a type constructor taking an argument of kindNat
? Should your example ofdata Vec :: Nat -> *
be insteaddata Vec a :: Nat -> *
to reflect thatVec
takes a type argument? – Assignment