From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id B793E7EE89 for ; Fri, 28 Oct 2016 15:25:38 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=nicolas.ojeda.bar@lexifi.com; spf=None smtp.mailfrom=nicolas.ojeda.bar@lexifi.com; spf=None smtp.helo=postmaster@vrout10.yaziba.net Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of nicolas.ojeda.bar@lexifi.com) identity=pra; client-ip=185.56.204.32; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="nicolas.ojeda.bar@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of nicolas.ojeda.bar@lexifi.com) identity=mailfrom; client-ip=185.56.204.32; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="nicolas.ojeda.bar@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@vrout10.yaziba.net) identity=helo; client-ip=185.56.204.32; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="postmaster@vrout10.yaziba.net"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AEKsRZhBlfEv5jIEJR3O0UyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSP74osbcNUDSrc9gkEXOFd2CrakV0ayJ6Ou9ByRAuc/H6y9SNsQUFlcsso?= =?us-ascii?q?Y/oU8JOIa9E0r1LfrnPWQRPf9pcxtbxUy9KlVfA83kZlff8TWY5D8WHQjjZ0Iu?= =?us-ascii?q?frymUqabtcm81viz9pvPeE0IwWPlOfIhZCmx+D7Rv9gQjMNMLqstwRvEuDMcYO?= =?us-ascii?q?Rf1GVlY1yXkgr35sqqusM72ytVsvMlscVHVPOpUb4/SOl+DT8hN2kurOrpuBXK?= =?us-ascii?q?BSGG/DNIVGQdlR5BGE7C7hz2V9H7uzHSsudt2Sebe8bxSOZnCnyZ8653RUqw22?= =?us-ascii?q?88PDkj/TSS05QogQ=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0C3AQB6URNYgCDMOLlcHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBgn8BAQEBAYF0B6Quh16HRocihiMCgXQHQhEBAQEBAQEBAQEBARI?= =?us-ascii?q?BAQsLCQkbMoIzBAEVAQSCEQEBBBIRBFIQCwsNKgICIQESAQUBHAYTIogYAxcEA?= =?us-ascii?q?aNCgTI/MotGiHYNg28BAQEHAQEBAQEiixKCR4UEglsBBI5Mixc1h2WFGoMokAS?= =?us-ascii?q?Ic4Qcgj8THoEPAjRxhRpwAYYogUoBAQE?= X-IPAS-Result: =?us-ascii?q?A0C3AQB6URNYgCDMOLlcHAEBBAEBCgEBFwEBBAEBCgEBgn8?= =?us-ascii?q?BAQEBAYF0B6Quh16HRocihiMCgXQHQhEBAQEBAQEBAQEBARIBAQsLCQkbMoIzB?= =?us-ascii?q?AEVAQSCEQEBBBIRBFIQCwsNKgICIQESAQUBHAYTIogYAxcEAaNCgTI/MotGiHY?= =?us-ascii?q?Ng28BAQEHAQEBAQEiixKCR4UEglsBBI5Mixc1h2WFGoMokASIc4Qcgj8THoEPA?= =?us-ascii?q?jRxhRpwAYYogUoBAQE?= X-IronPort-AV: E=Sophos;i="5.31,410,1473112800"; d="scan'208,217";a="242763347" Received: from vrout10.yaziba.net ([185.56.204.32]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 28 Oct 2016 15:25:38 +0200 Received: from mtaout20.int.yaziba.net (mtaout20.int.yaziba.net [10.4.20.37]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by vrout10.yaziba.net (mx10.yaziba.net) with ESMTPS id CA4BD5229D for ; Fri, 28 Oct 2016 15:25:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mtaout20.int.yaziba.net (Postfix) with ESMTP id EB24F16030D for ; Fri, 28 Oct 2016 15:25:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at mtaout20.int.yaziba.net Received: from mtaout20.int.yaziba.net ([127.0.0.1]) by localhost (mtaout20.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ID1bsCXiyIGA for ; Fri, 28 Oct 2016 15:25:37 +0200 (CEST) Received: from mail-qk0-f174.google.com (mail-qk0-f174.google.com [209.85.220.174]) by mtaout20.int.yaziba.net (Postfix) with ESMTPSA id BDDA61602F6 for ; Fri, 28 Oct 2016 15:25:37 +0200 (CEST) Received: by mail-qk0-f174.google.com with SMTP id v138so31022114qka.0 for ; Fri, 28 Oct 2016 06:25:37 -0700 (PDT) X-Gm-Message-State: ABUngvfQpK8MdaPhZSMyk+LVcMtvAIR2IIV9ySqYhu1amqslETHbXH4OgZL5w9fR2bkaxs9sFKw+R8fi5z/CMw== X-Received: by 10.55.20.164 with SMTP id 36mr10489450qku.86.1477661136721; Fri, 28 Oct 2016 06:25:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.53.109 with HTTP; Fri, 28 Oct 2016 06:25:16 -0700 (PDT) In-Reply-To: References: From: Nicolas Ojeda Bar Date: Fri, 28 Oct 2016 15:25:16 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Shayne Fletcher Cc: "caml-list@inria.fr users" Content-Type: multipart/alternative; boundary=001a1145e8d0272d15053feccb31 X-DRWEB-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrfeelvddrjeefgdeihecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepjghfhfffkffuvfgtsegrtderredttdejnecuhfhrohhmpefpihgtohhlrghsucfqjhgvuggruceurghruceonhhitgholhgrshdrohhjvggurgdrsggrrheslhgvgihifhhirdgtohhmqeenucfkphepvddtledrkeehrddvvddtrddujeegnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhht X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht Subject: Re: [Caml-list] Functor signature "inheritance" --001a1145e8d0272d15053feccb31 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Shayne, You can add a constrain to your functor arguments : module type MUL =3D functor (E : EQ) (N : NUM with type t =3D E.t) -> MUL_S with module N :=3D N and module E :=3D E Cheers, Nicolas On Fri, Oct 28, 2016 at 3:14 PM, Shayne Fletcher < shayne.fletcher.50@gmail.com> wrote: > > 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 =3D sig >> module X : EQ >> module Y : EQ >> type t =3D X.t * Y.t >> val eq: t * t -> bool >> end >> > > =E2=80=8BSorry to be a bother. Got another one for you Nicolas=E2=80=8B! > > How do I achieve the intent of this: > > module type EQ =3D sig > type t > val eq : t * t -> bool > end > > module type NUM =3D sig > type t > val from_int : int -> t > val ( + ) : t -> t -> t > end > > module type MUL_S =3D sig > module N : NUM > module E : EQ with type t :=3D N.t > > type t =3D N.t > val mul : t -> t -> t > end > > module type MUL =3D functor (E : EQ) (N : NUM) -> MUL_S with module N := =3D N > and module E :=3D 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 > --001a1145e8d0272d15053feccb31 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Shayne,

You can add a constrain to y= our functor arguments :

module type MUL =3D functo= r (E : EQ) (N : NUM with type t =3D E.t) ->
=C2=A0 =C2=A0 MUL_= S with module N :=3D N and module E :=3D E

Cheers,=
Nicolas

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

On Fri, Oct 28, 2016 at 9:01 AM, Nicolas Ojeda B= ar <nicolas.ojeda.bar@lexifi.com> wrote:
<= br>
One approach is to name the *output* signature of the functor= s:

module type EQ_PROD_S =3D sig
=C2=A0 = =C2=A0 module X : EQ
=C2=A0 =C2=A0 module Y : EQ
=C2=A0 =C2=A0 type t =3D X.t * Y.t
=C2=A0 =C2=A0 val eq: t * t -> bool
end
<= /blockquote>

=E2=80=8BSorry to be a bother. Got another one for you Nic= olas=E2=80=8B!

How do I ach= ieve the intent of this:

module type EQ =3D sig
=C2=A0 t= ype t
=C2=A0 val eq : t * t -> bool
end

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

module type MUL_S =3D sig
=C2=A0 module N : NUM
=C2= =A0 module E : EQ =C2=A0with type t :=3D N.t

=C2=A0 type t =3D N.t
=C2= =A0 val mul : t -> t -> t
end

module type MUL =3D functor (E : E= Q) (N : NUM) -> MUL_S with module N :=3D N and module E :=3D 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

--001a1145e8d0272d15053feccb31--