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