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 QAA26488; Fri, 6 Feb 2004 16:51:11 +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 QAA26942 for ; Fri, 6 Feb 2004 16:51:10 +0100 (MET) Received: from alex.baretta.com ([217.220.214.34]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id i16Fp9f21701 for ; Fri, 6 Feb 2004 16:51:09 +0100 (MET) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by alex.baretta.com (8.12.8/8.12.8) with ESMTP id i16FpMaI022097 for ; Fri, 6 Feb 2004 16:51:25 +0100 Message-ID: <4023B7FA.9080705@baretta.com> Date: Fri, 06 Feb 2004 16:51:22 +0100 From: Alex Baretta User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ocaml Subject: [Caml-list] What about polymorphic union types in functors? Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; baretta:01 baretta:01 functors:01 fragment:01 foo:01 val:01 foo:01 fragment:01 struct:01 functor:01 implements:01 ocaml:01 alex:01 alex:01 sig:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 Up to now I have used automatic code generation to actually write the ML file which implements the functor istantiation. Could such an extension be made to Ocaml type system? Alex ------------------- 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