Dear Nicolás,

thank you very match, it works as I wish :)

WBR, ssp

2017-11-23 18:14 GMT+05:00 Nicolás Ojeda Bär <nicolas.ojeda.bar@lexifi.com>:
Dear Serge,

If I understand correctly what you are asking, then you can make it work by wrapping the definition of topicf in an existential:

  module R = struct
    type topicf = TF : ((module I with type message = 'a) -> 'a -> 'a) -> topicf
    and topic = { func: topicf; name: string }
    ...
  end

then, given test, you can create an R.topic by doing

  { R.func = TF test; name = "test" }

Best wishes,
Nicolás


On Thu, Nov 23, 2017 at 1:52 PM, Serge Sivkov <ssp.mryau@gmail.com> wrote:
Hello,

is there way to define module with similar interface:

module R = struct
        type topicf = (module F : I) -> F.message -> F.message
        and topic = { func: topicf; name: string }
        ...
end

it is possible in case I want to define function with similar signature I can declare used types by:
let test (type message') (module M : I with type message = message') (v: message') : message' = ...

But how should I create such type in module?

WBR, ssp