Advertisement
Guest User

Untitled

a guest
Mar 19th, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. type yes
  2. type no
  3.  
  4. type _ expr =
  5.   | X : no expr
  6.   | Y : yes expr
  7.   | F1 : no expr * no expr -> no expr
  8.   | F2 : _ expr * yes expr -> yes expr
  9.   | F3 : yes expr * _ expr -> yes expr
  10.  
  11. let rec f : type maybe. maybe expr -> no expr = function
  12.   | X -> X
  13.   | Y -> X (* Error: This pattern matches values of type yes expr
  14.        but a pattern was expected which matches values of type no expr
  15.        Type yes is not compatible with type no *)
  16.   | F1 (x, y) -> F1 (f x, f y)
  17.   | F2 (x, y) -> F1 (f x, f y)
  18.   | F3 (x, y) -> F1 (f x, f y);;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement