caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Nicolas Ojeda Bar <nicolas.ojeda.bar@lexifi.com>
To: Shayne Fletcher <shayne.fletcher.50@gmail.com>
Cc: "caml-list@inria.fr users" <caml-list@inria.fr>
Subject: Re: [Caml-list] Functor signature "inheritance"
Date: Fri, 28 Oct 2016 15:01:30 +0200	[thread overview]
Message-ID: <CADK7aFOEJfpJObhX2rs4uHDO62B7e_jkzde2yxYLqgwB6tguHg@mail.gmail.com> (raw)
In-Reply-To: <CAMsAzy-x_j=3PPo-krQ08+PW5Y3fLgw2s=U28B5dpZ=PdYwOOw@mail.gmail.com>

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

Hi Shayne,

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

module type EQ_PROD = functor (X : EQ) (Y : EQ) ->
    EQ_PROD_S with module X := X and module Y := Y

module type ORD_PROD_S = sig
    include EQ_PROD_S
    val lt : t * t -> bool
end

module type LT_PROD = functor (X : EQ) (Y : EQ) ->
    LT_PROD_S with module X := X and module Y := Y

etc.

Cheers,
Nicolas



On Fri, Oct 28, 2016 at 2:44 PM, Shayne Fletcher <
shayne.fletcher.50@gmail.com> wrote:

> If one wants to include a functor signature in another...
>
> module type EQ = sig
>   type t
>   val eq : t * t -> bool
> end
>
> module type EQ_PROD = functor (X : EQ) (Y : EQ) ->
> sig
>     type t = X.t * Y.t
>     val eq : t * t -> bool
>   end
>
> module type ORD = sig
>   include EQ
>   val lt : t * t -> bool
> end
>
> module type LT_PROD = functor (X : EQ) (Y : EQ) ->
> sig
>   include EQ_PROD (*What do I say here?*)
> end
>
> ​... How does one do that? Is there a syntax for this sort of thing?​
>
> --
> Shayne Fletcher
>

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

  reply	other threads:[~2016-10-28 13:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28 12:44 Shayne Fletcher
2016-10-28 13:01 ` Nicolas Ojeda Bar [this message]
2016-10-28 13:04   ` Shayne Fletcher
2016-10-28 13:14   ` Shayne Fletcher
2016-10-28 13:25     ` Nicolas Ojeda Bar
2016-10-28 13:28       ` Shayne Fletcher
2016-10-28 13:47         ` rixed
2016-10-28 13:55           ` Shayne Fletcher
2016-10-28 15:44             ` Gabriel Scherer
2016-10-29  1:59               ` Shayne Fletcher
2016-10-28 16:12         ` Shayne Fletcher
2016-10-28 16:16           ` Shayne Fletcher
2016-10-28 16:17             ` Shayne Fletcher
2016-10-28 16:17           ` Nicolas Ojeda Bar
2016-10-28 16:36             ` Shayne Fletcher
2016-10-29 18:43       ` Shayne Fletcher

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=CADK7aFOEJfpJObhX2rs4uHDO62B7e_jkzde2yxYLqgwB6tguHg@mail.gmail.com \
    --to=nicolas.ojeda.bar@lexifi.com \
    --cc=caml-list@inria.fr \
    --cc=shayne.fletcher.50@gmail.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).