From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA02734; Fri, 6 Feb 2004 18:43:39 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA03276 for ; Fri, 6 Feb 2004 18:43:37 +0100 (MET) From: brogoff@speakeasy.net Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id i16Hhaf14296 for ; Fri, 6 Feb 2004 18:43:36 +0100 (MET) Received: (qmail 31721 invoked from network); 6 Feb 2004 17:43:35 -0000 Received: from grace.speakeasy.net ([216.254.0.22]) (envelope-sender ) by mail6.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 6 Feb 2004 17:43:35 -0000 Date: Fri, 6 Feb 2004 09:43:27 -0800 (PST) To: Ocaml Subject: Re: [Caml-list] What about polymorphic union types in functors? In-Reply-To: <4023B7FA.9080705@baretta.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; brogoff:01 caml-list:01 functors:01 baretta:01 fragment:01 foo:01 val:01 foo:01 fragment:01 struct:01 gcaml:01 gcaml:01 speakeasy:01 variants:01 alex:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 6 Feb 2004, Alex Baretta wrote: > Here what I need to do: > > module type FRAGMENT = sig > type foo (* Closed polymorphic union type *) > val do_something : foo -> whatever > end > > module Merge_fragments (F1:FRAGMENT) (F2:FRAGMENT) : #FRAGMENT = struct > type foo = [ F1.foo | F2.foo ] > let do_something = function > | #F1.foo as f1 -> F1.do_something f1 > | #F2.foo as f2 -> F2.do_something f2 > end Looks like you are implementing GCaml style polymorphism by hand. Last I read, work on GCaml was slated to resume after 3.07. The original system looked quite promising, but I have no idea how it will interact with the module system, and all of the other non corish extensions (OO, polymorphic variants, etc) that make up the full language. -- Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners