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 IAA04477; Sun, 15 Jun 2003 08:01:57 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA04456 for ; Sun, 15 Jun 2003 08:01:55 +0200 (MET DST) Received: from mail.speakeasy.net (mail11.speakeasy.net [216.254.0.211]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h5F61sT17485 for ; Sun, 15 Jun 2003 08:01:55 +0200 (MET DST) Received: (qmail 28505 invoked from network); 15 Jun 2003 06:01:53 -0000 Received: from unknown (HELO grace.speakeasy.org) ([216.254.0.2]) (envelope-sender ) by mail11.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 15 Jun 2003 06:01:53 -0000 Date: Sat, 14 Jun 2003 23:01:53 -0700 (PDT) From: brogoff@speakeasy.net To: caml-list@inria.fr Subject: [Caml-list] Polymorphic variants and signatures Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam: no; 0.00; brogoff:01 val:01 inst:99 functor:01 struct:01 speakeasy:01 variants:01 sig:01 rec:01 polymorphic:01 signatures:02 variant:02 module:03 string:03 define:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I've run into some issues with polymorphic variants that I can't find addressed in the manual. I'd like to define a module type which looks (simplified) like this module type CELL_TYPE = sig type ('a, 'b) t val show_rec : ('a -> ('b -> string) -> string) -> ([< ('b, 'a) t ] * 'c) inst -> ('b -> string) -> string ... end and obviously I can't because ('a, 'b) t is not a polymorphic variant type. Is there some way I can write such a module type, and, after having written it, use it in a functor as follows, module Make (Cell : CELL_TYPE) = struct type ('a, 'b) t = [`Newtag of 'b list | ('a, 'b) Cell.t] (* and some dispatch on `Newtag and #Cell.t *) end -- -- 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