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 NAA23060; Tue, 10 Apr 2001 13:31:11 +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 NAA23056 for ; Tue, 10 Apr 2001 13:31:10 +0200 (MET DST) Received: from quincy.inria.fr (quincy.inria.fr [128.93.8.52]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f3ABV5b22104; Tue, 10 Apr 2001 13:31:05 +0200 (MET DST) Received: (from mauny@localhost) by quincy.inria.fr (8.10.1/8.10.1) id f3ABWdR13932; Tue, 10 Apr 2001 13:32:39 +0200 Date: Tue, 10 Apr 2001 13:32:39 +0200 From: Michel Mauny To: reig@dcs.gla.ac.uk Cc: caml-list@inria.fr Subject: Re: [Caml-list] variant with tuple arg in pattern match? Message-ID: <20010410133239.B13189@quincy.inria.fr> Reply-To: Michel.Mauny@inria.fr References: <20010410102323.A13306@quincy.inria.fr> <200104101044.LAA10626@crab.dcs.gla.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i In-Reply-To: <200104101044.LAA10626@crab.dcs.gla.ac.uk>; from reig@dcs.gla.ac.uk on Tue, Apr 10, 2001 at 11:44:02AM +0100 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk reig@dcs.gla.ac.uk wrote/écrivait (Apr 10 2001, 11:44AM +0100): > This is how you do it in haskell: > > data T a = I Int > | B Bool > | N (T a) (T a) > | Uncurried (Int,Int) Sure. With CamlP4's revised syntax, you would write this as type t 'a = I of int | B of bool | N of (t 'a) and (t 'a) (* parens probably unnecessary *) | Uncurried of int * int > Moreover, the last part (-> 'a t) is the same for all constructors and > can be omitted like you do in haskell (so that Xavier is happier :) > > type 'a t = > Int : int > | Bool : bool > | Node : 'a t -> 'a t > | Uncurried : int * int I'm afraid the Node case is ambiguous, here. Is the type of Node 'a t -> 'a t -> 'a t or is it ('a t -> 'a t) -> 'a t ? In other words, you can't know wether Node carries functions, or is curried. -- Michel ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr