
5 Jan
2009
5 Jan
'09
5:52 p.m.
Hi Paul, You wrote:
Prelude> [] : [] [[]] it :: [[a]] I thought the first argument of ':' must be an element, so is the empty list an element of the same type of the contents of the empty list?
There is not just one "empty list". The symbol [] is actually polymorphic - it can refer to the empty list in [a], for any type a. In particular, "a" can itself be a list type. So [] : [] is an element of [[a]], the type of list of lists of a, for any type a. Hope this helps, Yitz