On Fri, Oct 28, 2016 at 9:01 AM, Nicolas Ojeda Bar <nicolas.ojeda.bar@lexifi.com> wrote:

One approach is to name the *output* signature of the functors:

module type EQ_PROD_S = sig
    module X : EQ
    module Y : EQ
    type t = X.t * Y.t
    val eq: t * t -> bool
end

​Sorry to be a bother. Got another one for you Nicolas​!

How do I achieve the intent of this:

module type EQ = sig
  type t
  val eq : t * t -> bool
end

module type NUM = sig
  type t
  val from_int : int -> t
  val ( + ) : t -> t -> t
end

module type MUL_S = sig
  module N : NUM
  module E : EQ  with type t := N.t

  type t = N.t
  val mul : t -> t -> t
end

module type MUL = functor (E : EQ) (N : NUM) -> MUL_S with module N := N and module E := E

The idea is that the modules satisfying EQ and NUM must agree in their type t and MUL brings them together and adds a 'mul' function.

--
Shayne Fletcher