Commit 7fedc432 by Giuseppe Castagna

parent 8ff33414
 ... ... @@ -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) ;;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!