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 546E37FF3C for ; Fri, 28 Oct 2016 15:15:06 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=shayne.fletcher.50@gmail.com; spf=Pass smtp.mailfrom=shayne.fletcher.50@gmail.com; spf=None smtp.helo=postmaster@mail-yb0-f173.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of shayne.fletcher.50@gmail.com) identity=pra; client-ip=209.85.213.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="shayne.fletcher.50@gmail.com"; x-sender="shayne.fletcher.50@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of shayne.fletcher.50@gmail.com designates 209.85.213.173 as permitted sender) identity=mailfrom; client-ip=209.85.213.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="shayne.fletcher.50@gmail.com"; x-sender="shayne.fletcher.50@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-yb0-f173.google.com) identity=helo; client-ip=209.85.213.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="shayne.fletcher.50@gmail.com"; x-sender="postmaster@mail-yb0-f173.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AjaxMfRMzs/PlE9RhCn8l6mtUPXoX/o7sNwtQ0KIM?= =?us-ascii?q?zox0KP34rarrMEGX3/hxlliBBdydsKMezbWN+P2+ESxYuNDa7yBEKMQNHzY+yu?= =?us-ascii?q?wo3CUYSPafDkP6KPO4JwcbJ+9lEGFfwnegLEJOE9z/bVCB6le77DoVBwmtfVEt?= =?us-ascii?q?fre9ScbuiJGR1uu1/5TIKyJKiTa0KZl7Nl3iqwTasc0fms1lKKs9w13Dq2Fgf+?= =?us-ascii?q?lGxG1pY1mUmkCvyN23+ctY8y1Bvf9p2cpNTa76cr5wGadYBSUgPiY74MD3vhnO?= =?us-ascii?q?V03SvlMTV2wXllxDBA2Tv0KyZYv4riav7rk14yKdJ8CjFb0=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DaAAACTxNYh63VVdFcHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBgn8BAQEBAYF0B40vln+ITIQFglOFG4IHhiMCgXgHPxQBAQEBAQE?= =?us-ascii?q?BAQEBARIBAQEIDQkJHTCCMxiCGAEBAwESEQQZARsdAQMMBgULNwICIgERAQUBH?= =?us-ascii?q?AYTIogXAQMPCKNAgTI/MotGgWuCXwWDXAoZJw1TgxwBAQEBBgEBAQEBARkCBhC?= =?us-ascii?q?LAodLglsFgSUBjSaLQggBAYEnhj6IQpAEjQ+CPxMegREegUuCViCBeiI0AYdyA?= =?us-ascii?q?QEB?= X-IPAS-Result: =?us-ascii?q?A0DaAAACTxNYh63VVdFcHAEBBAEBCgEBFwEBBAEBCgEBgn8?= =?us-ascii?q?BAQEBAYF0B40vln+ITIQFglOFG4IHhiMCgXgHPxQBAQEBAQEBAQEBARIBAQEID?= =?us-ascii?q?QkJHTCCMxiCGAEBAwESEQQZARsdAQMMBgULNwICIgERAQUBHAYTIogXAQMPCKN?= =?us-ascii?q?AgTI/MotGgWuCXwWDXAoZJw1TgxwBAQEBBgEBAQEBARkCBhCLAodLglsFgSUBj?= =?us-ascii?q?SaLQggBAYEnhj6IQpAEjQ+CPxMegREegUuCViCBeiI0AYdyAQEB?= X-IronPort-AV: E=Sophos;i="5.31,410,1473112800"; d="scan'208,217";a="242761173" Received: from mail-yb0-f173.google.com ([209.85.213.173]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 28 Oct 2016 15:15:01 +0200 Received: by mail-yb0-f173.google.com with SMTP id d128so34762801ybh.2 for ; Fri, 28 Oct 2016 06:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HSz7Fub7bOZ1ZZYhbZgiM1EQX247Tz4e1KTl56otb/k=; b=dOj/FiKB9II2i9fJIKemCbJ4Rw+rbSEynAW7cLm3fp1l9o9eQyqtTDfZL8ijYfe53i L8YJ3/5aZ0MhVPXwdCPcesjUGPC5797qtFsW6UZFIBTotZxgslzba4xtvTGFPUBn2k9k 4s/nTCbjF56Ir7pqh1b2ML6ENIcbbhjahtXCHj9bBWeeuM86ywvZxVAYA+ucYK7yvXNi 035ul7Cv5gV731RdxScsxUc/gsp4ltGaUuV/fdSXgXDAT8hepYnGtp5Xw3s28vcp5eJ7 vkuUQYhjgqjoFW1YDqBVMqQ4GVy1DJV1z3uiZeHYXQwmmKke6GWdFjijDCo+5r81VaWh JOGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HSz7Fub7bOZ1ZZYhbZgiM1EQX247Tz4e1KTl56otb/k=; b=hJW+d06kCoKmng/+u52vNS6VDBBL9zYptjh5+t4UbRsaOWqL1SySKRTfA1CwGSzLsH ViqIxUQhaUzbU9u5OroJneKJLInDGQ07kQkGF5DHKKbqQMvNponyeQooBChS1gfCjMmT qJg2Z5x9oDRKLYAdFXSag8TCUGgXQ4+MpEIK88F+ymIzMOQxYkCD8xzdyTHAKfoeaCcd UoPTSmk9u13egJA8EzjoUXIjpbJiCsaZGVoUVBTlzB8Pe0r5ws5Km7BH2xIe70wE6s4u MCtHYGOt6woM1CXHyzcCGuQXVWopDlhu1saIRKaQ5/lG67FhkdfRQIaO2cXIsIBA3uFh 97FA== X-Gm-Message-State: ABUngveJIPCuoA4sJjujjG8MWcYZK9UACH+peQxGywIUXQaiIqxqt01HNBASAbvQ19AzAEKM2L22vR7MqZ/OTg== X-Received: by 10.37.106.138 with SMTP id f132mr4928776ybc.138.1477660500414; Fri, 28 Oct 2016 06:15:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.39.202 with HTTP; Fri, 28 Oct 2016 06:14:39 -0700 (PDT) In-Reply-To: References: From: Shayne Fletcher Date: Fri, 28 Oct 2016 09:14:39 -0400 Message-ID: To: Nicolas Ojeda Bar Cc: "caml-list@inria.fr users" Content-Type: multipart/alternative; boundary=001a113fca8639dd2e053feca548 Subject: Re: [Caml-list] Functor signature "inheritance" --001a113fca8639dd2e053feca548 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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. --=20 Shayne Fletcher --001a113fca8639dd2e053feca548 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

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

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

module type EQ_PROD_S = =3D sig
=C2=A0 =C2=A0 module X : EQ
=C2=A0 =C2=A0 modul= e Y : EQ
=C2=A0 =C2=A0 type t =3D X.t * Y.= t
=C2=A0 =C2=A0 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
=C2=A0 type t
=C2=A0 val eq = : t * t -> bool
end

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

mod= ule type MUL_S =3D sig
=C2=A0 module N : NUM
=C2=A0 module E : EQ =C2=A0wi= th type t :=3D N.t

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

module type MUL =3D functor (E : EQ) (N : NUM) -> MUL_S w= ith module N :=3D N and module E :=3D E

The idea is that the modules satisfying EQ and NUM must agree in their ty= pe t and MUL brings them together and adds a 'mul' function.
<= /div>

--
Shayne Fletcher
--001a113fca8639dd2e053feca548--