Consider the following:
--- a.mli
module type B = sig
type t
end
module type S = sig
type t
type other_lenghty_definitions
val not_much_code : t
end
module Make (B : B) : S
with type t = B.t
---
--- a.ml
module type B = sig
type t
end
module type S = sig
type t
type other_lenghty_definitions
val not_much_code : t
end
module Make (B : B) = struct
type t = B.t
type other_lenghty_definitions
let not_much_code = assert false
end
---
So we have to keep 3 copies of other_lenghty_definitions. I can have it
isolated in a separate file and insert into a.ml and a.mli in an extra
preprocessing step. But I believe there should be some clean solution,
something like the following:
--- c_sig.ml
module S = struct
type t
type other_lenghty_definitions
end
module type S = sig
include (module type of S) (* 1 *)
val not_much_code : t
end
---
--- c.mli
module type B = sig
type t
end
module Make (B : B) : C_sig.S
with type t = B.t
---
--- c.ml
module type B = sig
type t
end
module Make (B : B) = struct
include C_sig.S
with type t = B.t (* 2 *)
let not_much_code = assert false
end
---
How to do what I mark with (* 1 *) and (* 2 *) correctly? Would it help
if I upgrade my toolchain from 3.11.2 to some more recent version?
Dawid
--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs