99c5a3678083c42dc3b54d05c006dfbc72f1814b
[cc1516.git] / examples / Markus / polymorphic_value_shouldfail.spl
1 // This is an example why you need the value restriction.
2 // This program should give a type error in some way.
3
4 // The empty list [] usually has polymorphic type forall a.[a], but you
5 // cannot give the variable l this type. See below what can go wrong.
6
7 f()
8 {
9 var l = [];
10 // If l has polymorphic type forall a . [a], the next two lines are possible.
11 l = 1:l;
12 l = True:l;
13 return;
14 }
15 main() {return;}