caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Serge Sivkov <ssp.mryau@gmail.com>
To: "Nicolás Ojeda Bär" <nicolas.ojeda.bar@lexifi.com>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] module and it's types as function parameters
Date: Fri, 24 Nov 2017 10:27:02 +0500	[thread overview]
Message-ID: <CAOUGqWwtV8bce5=C6K4+yj2cSBSdRAtTjNhoc-d8G63GRERWnA@mail.gmail.com> (raw)
In-Reply-To: <CADK7aFO54QW_-vKr6vvGNSTeTFWKSTpc1SsFW54wXJUB9mwgYQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]

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
>>
>
>

[-- Attachment #2: Type: text/html, Size: 2407 bytes --]

      reply	other threads:[~2017-11-24  5:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 12:52 Serge Sivkov
2017-11-23 13:14 ` Nicolás Ojeda Bär
2017-11-24  5:27   ` Serge Sivkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOUGqWwtV8bce5=C6K4+yj2cSBSdRAtTjNhoc-d8G63GRERWnA@mail.gmail.com' \
    --to=ssp.mryau@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=nicolas.ojeda.bar@lexifi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).