1 // Idea here is to test the following property:
2 // When a function is called recursively it has locally a monomorphic type.
3 // Therefore the definition of cons does not work even if it works
4 // with a proper type annotation.
6 data Vec a = Nil | Zero (Vec (a,a)) | One a (Vec (a,a))
8 // cons :: a -> Vec a -> Vec a
10 cons x (Zero ps) = One x ps
11 cons x (One y ps) = Zero (cons (x, y) ps)
13 11:21-11:42: Expected <Vec (a, a)> got <Vec a>.
14 11:33-11:34: Type (a, a) is not a subtype of a.
15 11:36-11:37: Type (a, a) is not a subtype of a.
16 11:39-11:41: Expected <Vec a> got <Vec (a, a)>.