To supplement ygrek with a response with a sample of real code instead of a foo.ml
file with content
module type S = sig (* ... *) end module Hello (M : S) = struct (* ... *) end module M : S = struct (* ... *) end module H = Hello(M) (* ... *)
You may have hello.ml
with content
module type S = sig (* ... *) end module Make (M : S) = struct (* ... *) end
and foo.ml
rewritten as
module M : Hello.S = struct (* ... *) end module H = Hello.Make(M) (* ... *)
PS: If you think this is confusing, compacting the M : S
or M : Hello.S
is optional (M will be forced to apply to this signature when it is passed to the functor), it was just to show how this can be done.
source share