From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr 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 DCADF81792 for ; Mon, 24 Jun 2013 01:15:41 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of garrigue@math.nagoya-u.ac.jp) identity=pra; client-ip=133.6.130.5; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="garrigue@math.nagoya-u.ac.jp"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of garrigue@math.nagoya-u.ac.jp) identity=mailfrom; client-ip=133.6.130.5; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="garrigue@math.nagoya-u.ac.jp"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mailhost.math.nagoya-u.ac.jp) identity=helo; client-ip=133.6.130.5; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="postmaster@mailhost.math.nagoya-u.ac.jp"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah0BAI6Ax1GFBoIFnGdsb2JhbABbwzqBFA4BAQEBAQgUCTyCIwEBBAE6CQE1AgMLCw4mElcGExoBh20Fpw6ERwKEZIgAB48cMweDAmGJIo4klGM X-IPAS-Result: Ah0BAI6Ax1GFBoIFnGdsb2JhbABbwzqBFA4BAQEBAQgUCTyCIwEBBAE6CQE1AgMLCw4mElcGExoBh20Fpw6ERwKEZIgAB48cMweDAmGJIo4klGM X-IronPort-AV: E=Sophos;i="4.87,924,1363129200"; d="scan'208";a="23015329" Received: from rabbit.math.nagoya-u.ac.jp (HELO mailhost.math.nagoya-u.ac.jp) ([133.6.130.5]) by mail2-smtp-roc.national.inria.fr with ESMTP; 24 Jun 2013 01:15:40 +0200 Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id A4AC4639A; Mon, 24 Jun 2013 08:15:38 +0900 (JST) Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id 1D534396A; Mon, 24 Jun 2013 08:15:38 +0900 (JST) DomainKey-Signature: h=Received:Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=; c=nofws; d=math.nagoya-u.ac.jp; q=; s=alpha Received: from tet.garrigue.jp (58x158x128x157.ap58.ftth.ucom.ne.jp [58.158.128.157]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTPSA id C2F422517; Mon, 24 Jun 2013 08:15:37 +0900 (JST) Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Content-Type: text/plain; charset=us-ascii From: Jacques Garrigue In-Reply-To: <001601ce6fe1$a2ea9390$e8bfbab0$@metastack.com> Date: Mon, 24 Jun 2013 08:15:38 +0900 Cc: "OCaml List" Content-Transfer-Encoding: quoted-printable Message-Id: References: <001601ce6fe1$a2ea9390$e8bfbab0$@metastack.com> To: David Allsopp X-Mailer: Apple Mail (2.1508) Subject: Re: [Caml-list] Anonymous sum types in functors On 2013/06/23, at 16:16, David Allsopp wrote: > module FlagSet =3D Set.Make(struct type t =3D A | B let compare =3D compa= re end) [doesn't work] > but I'm wondering: >=20=20 > a) Is there a way to do it where you can end up with type elt =3D A | B (= I think the answer is no?) Xavier described the official solution. However, since 3.12 you can also do some trickery. This is going to be heavier, so this is probably a bad idea, but if you rea= lly need it, here it is: module FlagSet =3D struct type elt =3D A | B include (Set.Make (struct type t =3D elt let compare =3D compare end) : S= et.S with type elt :=3D elt) end Jacques Garrigue=