diff --git a/tests/poly/part2.cd b/tests/poly/part2.cd index 8cdde78c50466731c4e6c3016375522d33a3ff02..098f13f8978fc79d5306c24cb90d41f1e158873e 100644 --- a/tests/poly/part2.cd +++ b/tests/poly/part2.cd @@ -41,9 +41,34 @@ let balance ( Unbal ->Rtree ; ('b \ Unbal) ->('b \ Unbal) ) -> [ [ a b ] [ c d ] ] | x -> x ;; +let r = balance [ [ [ 1 2] 3 ]4];; +let id ('a -> 'a) + Int -> "foo" + | x -> x +;; + +(* some tricky examples *) let f (_ : ('a | 'b | 'c)) (_ : (Int&'d&'e \1--3 )) : Any = raise "123";; +let x = id even (even mmap) even;; (* same type as map_even *) + +let twisted = id even (even mmap) even (mmap max [1 2 3 4 5 6]);; + +let apply_to_3 (f: Int -> 'a): 'a = f 3 in + mmap apply_to_3 twisted +;; + +type A = 'a +type B = [(A|B)];; + +let f (_ : 'a -> 'a -> 'a)(z : 'a)(_ : A|B) : A = z;; + +let x = f sum;; + + +(* Some expressions that are ill typed *) + let balance (Unbal ->Rtree ; 'a -> 'a ) | [ [ [ a b ] c ] d ] | [ [ a [ b c ] ] d ] @@ -52,12 +77,10 @@ let balance (Unbal ->Rtree ; 'a -> 'a ) -> [ [ a b ] [ c d ] ] | x -> x ;; -let r = balance [ [ [ 1 2] 3 ]4];; let id ('a -> 'a) Int -> "foo" | x -> x ;; -id 42;; let apply ( f : 'a -> 'b) (x : 'a ) : 'b = f (x,x) ;;