View difference between Paste ID: Y2wu8Bvf and a04WbDTC
SHOW: | | - or go back to the newest paste.
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 : 'maybe expr -> no expr = function
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)
16+
  | F1 (x, y) -> F1 (f x, f y)
17-
  | F2 (x, y)
17+
  | F2 (x, y) -> F1 (f x, f y)
18-
  | F3 (x, y) -> F1 (f x, f y)
18+
  | F3 (x, y) -> F1 (f x, f y);;