[Haskell-beginners] Type * and * -> *
Galaxy Being
borgauf at gmail.com
Sat Mar 13 06:18:26 UTC 2021
I found this interesting page <https://wiki.haskell.org/Peano_numbers> at
Wiki Haskell. Confusing, however, is how it first establishes
data Peano = Zero | Succ Peano
It says
Here Zero and Succ are values (constructors). Zero has type Peano,
and Succ has type Peano -> Peano.
but then it breaks down each member further a few lines later
data Zero
data Succ a
and then says
Zero has kind *, and Succ has kind * -> *. The natural numbers are
represented by types (of kind *) Zero, Succ Zero, Succ (Succ Zero) etc.
Why is it giving two separate treatments and what is meant by the * and *
-> * ? There's something fundamental I'm missing.
If anyone knows of a really thorough and definitive *and *understandable
treatment of Haskell types, I'd appreciate it.
LB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210313/f3d48623/attachment.html>
More information about the Beginners
mailing list