File "pr3968_bad.ml", lines 20-29, characters 0-3: 20 | object 21 | val l = e1 22 | val r = e2 23 | method eval env = 24 | match l with 25 | | `Abs(var,body) -> 26 | Hashtbl.add env var r; 27 | body 28 | | _ -> `App(l,r); 29 | end Error: The class type object val l : [ `Abs of string * ([> `App of 'a * exp ] as 'b) | `App of expr * expr ] as 'a val r : exp method eval : (string, exp) Hashtbl.t -> 'b end is not matched by the class type exp The class type object val l : [ `Abs of string * ([> `App of 'a * exp ] as 'b) | `App of expr * expr ] as 'a val r : exp method eval : (string, exp) Hashtbl.t -> 'b end is not matched by the class type object method eval : (string, exp) Hashtbl.t -> expr end The method eval has type (string, exp) Hashtbl.t -> ([> `App of [ `Abs of string * 'a | `App of expr * expr ] * exp ] as 'a) but is expected to have type (string, exp) Hashtbl.t -> expr Type [> `App of [ `Abs of string * 'a | `App of expr * expr ] * exp ] as 'a is not compatible with type expr = [ `Abs of string * expr | `App of expr * expr ] Type exp = < eval : (string, exp) Hashtbl.t -> expr > is not compatible with type expr = [ `Abs of string * expr | `App of expr * expr ] Types for tag `App are incompatible