Type sharing in OCaml - typechecker error
问题 When compiling this program: module type Inc = sig type t val inc : t -> t end module type Dec = sig type t val dec : t -> t end module Merger (I : Inc) (D : Dec with type t = I.t) = struct let merge x = x |> I.inc |> D.dec end module IntInc : Inc = struct type t = int let inc x = x + 10 end module IntDec : Dec = struct type t = int let dec x = x - 8 end module Combiner = Merger (IntInc) (IntDec) I get the following error: File "simple.ml", line 30, characters 35-41: Error: Signature mismatch