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 BAA03645; Wed, 25 Jun 2003 01:45:20 +0200 (MET DST) 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 BAA02837 for ; Wed, 25 Jun 2003 01:45:19 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h5ONjFj25646 for ; Wed, 25 Jun 2003 01:45:16 +0200 (MET DST) Received: from localhost (suiren.kurims.kyoto-u.ac.jp [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.9.3p2/3.7W) with ESMTP id IAA29378; Wed, 25 Jun 2003 08:45:08 +0900 (JST) In-Reply-To: References: <3EF847E2.1010501@ozemail.com.au> Subject: Re: [Caml-list] First order compile time functorial polymorphism in Ocaml To: carette@mcmaster.ca Cc: caml-list@inria.fr X-Mailer: Mew version 1.94.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20030625084518L.garrigue@kurims.kyoto-u.ac.jp> Date: Wed, 25 Jun 2003 08:45:18 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) X-Spam: no; 0.00; jacques:01 caml-list:01 functorial:01 partition:01 symmetric:01 ocaml:01 variants:01 garrigue:01 polymorphic:01 variant:02 compile:02 classes:03 types:03 incremental:05 confusing:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: "Jacques Carette" > > or perhaps > > | #usual_case -> > > instead of the last line if there happens to be > > a type partition matching the requirements. > > I read about #types in the Ocaml manual. Are you referring to using > classes or the (documented obsolete) expansion of variant types ? I know this is a bit confusing, but this is the pattern case expansion of polymorphic variants (the above is a pattern-matching, not a type), and this is not obsolete. The notatation is obsolete in types, as [< usual_case] is more symmetric with [> usual_case]. By the way, fun #usual_case as x -> x has type [< usual_case] -> [> usual_case] But honestly, if you have no particular need to cut your type in small pieces (you need it for incremental extension for instance), you're better off with sum types, and the safe approach I presented in my previous mail. Jacques ------------------- 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