[Haskell-cafe] Possibly an error in Tutorial?
Ignat Insarov
kindaro at gmail.com
Mon Jan 13 06:21:13 UTC 2020
In this line:
> For example, the principal type of `head` is `[a]->a`; `[b]->a`, `a->a`, or even `a` are correct types, but too general, whereas something like `[Integer]->Integer` is too specific.
— It is not clear how `a → a` can be a correct type for `head`,
insofar as all occurrences of a type variable must be instantiated to
the same concrete type. If this sentence is actually correct, perhaps
it could be clarified to address the issue?
This concern was raised on Reddit:
https://www.reddit.com/r/haskellquestions/comments/enqhu0/how_does_head_have_type_a_a/
Link to tutorial:
https://www.haskell.org/tutorial/goodies.html
More information about the Haskell-Cafe
mailing list