Julien Moutinho <julien.moutinho@gmail.com> writes:
> I'm not sure if it could be of some help, but here is another scheme
> wherein the functor <name>Type.Make does not include its argument PROTO,
> so that there is no namespace conflict with type t.
> However the PROTO structure can no longer be used anonymously:
This is fine. Here's how I will work it out:
module Ordered =
struct
module type PROTO =
type t
val compare: t -> t -> int
end
module type S =
type t
val compare: t -> t -> int
val ge: t -> t -> bool
end
module Macro (P:PROTO) =
struct
let ge x y = (compare x y) >= 0
end
module Make (P:PROTO) =
struct
type t = P.t
include Macro(P)
end
end
It seems as economic as possible, provided I want to provide both the
`Macro' and `Make' version. Thanks for the hint!
--
Cordialement,
MichaÃ«l LB