Advertisement
Guest User

Untitled

a guest
Aug 14th, 2016
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.45 KB | None | 0 0
  1. type (_, _, _) desc =
  2.     | L : ('a, _, 'a) desc
  3.     | R : (_, 'b, 'b) desc
  4.  
  5. type (_, _, _) t =
  6.     Tee : ('a, 'b, 'e) desc * ('e -> 't) -> ('a, 'b, 't) t
  7.  
  8. let id x = x
  9.  
  10. (* this works as expected *)
  11. let test_1 : type a b c . (a, b, c) desc -> (a, b, c) t =
  12.     function
  13.     | L -> Tee (L, id)
  14.     | R -> Tee (R, id)
  15.  
  16. (* this will cause type error *)
  17. let test_2 : 'a 'b 'c . ('a, 'b, 'c) desc -> ('a, 'b, 'c) t =
  18.     function
  19.     | L -> Tee (L, id)
  20.     | R -> Tee (R, id)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement