ocamllabs / ocaml-modular-implicits

OCaml extended with modular implicits
Other
103 stars 8 forks source link

Ctype.Unify failure #60

Open yallop opened 1 year ago

yallop commented 1 year ago

Another example of an ill-typed program that fails gracelessly with Fatal error: exception Ctype.Unify(_):

module type S = sig
  type r and 'b m and x = r and 'a t = S of (x -> 'a m)
  val f : 'b m -> 'b m
end

let g {T : S} (T.S f) = f
let f {T:S} ff = T.S (fun r -> T.f (g ff ()))