Possibly an error in Tutorial?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Possibly an error in Tutorial?

Ignat Insarov
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
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.