From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p0IE3HZZ023500 for ; Tue, 18 Jan 2011 15:03:17 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApgAAJ8sNU3RVdU2kGdsb2JhbACkUggVAQECCQkMBxEEIKkyjBKFA4dBAQEDBYVLBIRthjGED4U4 X-IronPort-AV: E=Sophos;i="4.60,339,1291590000"; d="scan'208";a="73407203" Received: from mail-yw0-f54.google.com ([209.85.213.54]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-MD5; 18 Jan 2011 15:03:11 +0100 Received: by ywp6 with SMTP id 6so2128912ywp.27 for ; Tue, 18 Jan 2011 06:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=A/gMXNgHdWkkX/JgfL7Whvt1Xrp/nlJyfN2TGuxhmZg=; b=aQwKg16E7doxqONuxnhsqHixwVinTiXkKqrUyKrYkOFHimNIN4rcKAyUnynFidU5v1 LOa2VOwx+oXe7b+NBnhM9uO/xwhUNjdqXLpn6MJH9n7Gx6JZHk9cshN/Je4PbL0ku2YE GvEPRZzhqvZ8Xfvh/KBNG8Flg+e9lWBdewozs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=IB1Vl7n4Y3OMV/pLABG5kgp2ZNshHvk8ZZfZtk1y//2Z/HN7VROw8iHpsvlb7yPm2c WzqGp68lFOHk+rGcU5eCmd2K2VLL/8+hxrzbN3be+f74Y+i2cLbPn20SK75C/8+gLuYz LJliIxQQRspmMN0jdjeDMHV9EmlhBWfKA0Lgk= Received: by 10.100.122.3 with SMTP id u3mr3563263anc.30.1295359390322; Tue, 18 Jan 2011 06:03:10 -0800 (PST) Received: from tet.garrigue.jp (58x158x128x157.ap58.ftth.ucom.ne.jp [58.158.128.157]) by mx.google.com with ESMTPS id c28sm7020942ana.1.2011.01.18.06.03.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 18 Jan 2011 06:03:08 -0800 (PST) Sender: Jacques Garrigue Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Jacques Garrigue In-Reply-To: <20110118121036.GK323@melkinpaasi.cs.helsinki.fi> Date: Tue, 18 Jan 2011 23:03:05 +0900 Cc: OCaml List Content-Transfer-Encoding: 7bit Message-Id: References: <20110118020018.GI323@melkinpaasi.cs.helsinki.fi> <7f9a42a3cac8ea539f9f48432cd8a5af.squirrel@mail.mpi-sws.org> <20110118121036.GK323@melkinpaasi.cs.helsinki.fi> To: Lauri Alanko X-Mailer: Apple Mail (2.1082) Subject: Re: [Caml-list] Signature monomorphism in functors On 2011/01/18, at 11:00, Lauri Alanko wrote: > I guess what I want is "bounded signature polymorphism" of some sort: > > module F(A : sig module type S <: S1 module M : S end) > : S3 with module M = A.M = > struct > module M = A.M > end > > module M3B : S3 with module M = M2 = > F(struct module type S = S2 module M = M2 end) > > Alas, there are no signature bounds in ocaml and I cannot offhand > think of a way to encode them. You can always encode it by using an abstract module type: module type S1' = sig type t module type X module X : X end This way you can put anything you wish in X. But this is going to be pretty heavy to use... Alternatively, if you don't need all the functionality of modules, objects let you do exactly that. A function from objects to objects may be polymorphic in the available methods. Jacques Garrigue