Hi everyone,
consider the following not working example:
module type CS = sig
type t
type content
val make: content -> t
val to_string: t -> string
end
module C : CS with type content = int = struct
type content = int
type t = { x: content }
let make x = { x }
let to_string { x } = string_of_int x
end
module type S = sig
module C: CS
val f: C.t -> unit
end
module Make(C: CS) : S = struct
module C = C
let f c = print_endline (C.to_string c)
end
module M = Make(C)
let _ =
let c = C.make 0 in
M.f (M.C.make 0)
Here is my problem: whereas the sharing constraint with type content = int
allows me to call directly C.make
with an int
, I need, in order to use M.f
to use M.C.make
.
But the compiler will output about the integer:
Error: This expression has type int but an expression was expected of type M.C.content
Is there a way to somehow force the sharing constraint to be visible through the instantiation of the functor ?
I tried for example module M = Make(C : CS with type content = int)
, without success.