Well, the problem is, that the ocaml type inference forbids a function to return a polymorphic value, so the type of make_mem' is only ('_a -> '_b) -> '_a -> '_b. So the right thing to do here (as this type is, obviously, incorrect) is to use Obj.magic:


I'm sorry, the OCaml  type inference is correct to infer the type ('_a -> '_b) -> '_a -> '_b here, but I believe that there can be no error caused generalizing it.