To understand why the expression: [ [], [[]], [[[]]], [[[[]]]], [[[[[ ]]]]] ]
has type [[[[[[a]]]]]]
, you need to understand what is the type of []
first.
Actually, []
is equivalent to [a']
, where a'
is type variable without any constraint. That means a'
can be any type. So, when a list is constructed, say, [ [], [[]] ]
, it is legal to replace a'
with [a]
as:
[ [], [[]] ] ~ [ [a'] [[a]] ] ~ [ [[a]], [[a]] ] ~ [ [[a]] ]
The same reason why
[ [], [[]], [[[]]], [[[[]]]], [[[[[ ]]]]] ] ~ [ [[[[[a]]]]] ]
But when you constructs a list as [ [True], [[]] ]
, there is no way to convert True
to a list, even though [a]
can be any type of list. The same reason why [ [True], [[]], [[[]]], [[[[]]]], [[[[[]]]]] ]
is illegal.