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 p0QFIkbM010074 for ; Wed, 26 Jan 2011 16:18:46 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtwAAG/KP03RVdc2kGdsb2JhbACkbwgVAQEBAQkJDAcRBCCiPpoohU8E X-IronPort-AV: E=Sophos;i="4.60,380,1291590000"; d="scan'208";a="74187484" Received: from mail-ew0-f54.google.com ([209.85.215.54]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-MD5; 26 Jan 2011 16:18:02 +0100 Received: by ewy24 with SMTP id 24so293582ewy.27 for ; Wed, 26 Jan 2011 07:18:01 -0800 (PST) Received: by 10.14.52.13 with SMTP id d13mr691165eec.11.1296055078133; Wed, 26 Jan 2011 07:17:58 -0800 (PST) Received: from gloster.vectorfabrics.com (84-53-79-176.adsl.unet.nl [84.53.79.176]) by mx.google.com with ESMTPS id t50sm12085706eeh.18.2011.01.26.07.17.56 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 26 Jan 2011 07:17:57 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Stefan Holdermans In-Reply-To: Date: Wed, 26 Jan 2011 16:17:56 +0100 Cc: Caml List Message-Id: <5E6C5936-42DB-4816-9CCC-089440DAD33F@vectorfabrics.com> References: To: Julien Signoles X-Mailer: Apple Mail (2.1082) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p0QFIkbM010074 Subject: Re: [Caml-list] Converting "fun ... (type t) ..." into a caml < 3.12 code Julien, > How to convert the following ocaml 3.12 code into a typable ocaml < 3.12 code? Coincidentally, earlier today, I ran into a situation not that different from the one you describe. I haven't come up with a satisfying solution yet. > I have a solution using Obj. Is it possible without Obj? Are you willing to share this solution? > ===== > (* val f: 'a -> 'a list *) > let f (type u) (x:u) = > let module S = > Set.Make(struct > type t = u > let compare = Pervasives.compare > let equal = ( = ) > end) > in > S.elements (S.singleton x) > ===== > > The contraints are: > * do not change the type of f > * use the functor Set.Make where type of keys are the same that type of x Cheers, Stefan