From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id BB517BC69 for ; Wed, 11 Apr 2007 13:43:50 +0200 (CEST) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.234]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3BBhnDG012830 for ; Wed, 11 Apr 2007 13:43:50 +0200 Received: by wr-out-0506.google.com with SMTP id i3so112605wra for ; Wed, 11 Apr 2007 04:43:49 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=PhODDnTRAskzwMjtePEWypAA6uOqN0tXMYh8ITJ9o6dwknV+FgHdIWi0tq5LwTrrZ7jKBd6GCnEHjPAfN2kFKQJFpW86ubU30wHIR+VA3ChlZdm4eKGG/I0uT8C8ZniiWTJeTFTIJH/S+jHARlrTJr5seZ3HvTq1Wd9oIVDTwPQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=aCPHkvEdXTvQ4zPghK7L/blffoggGaWylQTxNdl4SqIyYTYzSQJs/PEBIgc20zE91SOVHT9Rfamw6ayMtMDDIuUZCrvauZDsxitDl/kBSpl8a7VctPFYgJg0h91Q/xf9fg67VxeMnMQXTewFX6QSC1K2n7NSsBNF/f9CLv3DdVE= Received: by 10.114.126.1 with SMTP id y1mr229736wac.1176291828569; Wed, 11 Apr 2007 04:43:48 -0700 (PDT) Received: by 10.114.181.18 with HTTP; Wed, 11 Apr 2007 04:43:48 -0700 (PDT) Message-ID: Date: Wed, 11 Apr 2007 13:43:48 +0200 From: "Nicolas Pouillard" To: "Pietro Abate" , "ocaml ml" Subject: Re: [Caml-list] (old) camlp4 question In-Reply-To: <20070411105949.GA7707@pulp.rsise.anu.edu.au> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070411105949.GA7707@pulp.rsise.anu.edu.au> X-j-chkmail-Score: MSGID : 461CC9F5.000 on concorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at concorde with ID 461CC9F5.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 ctyp:01 ctyp:01 syntax:01 sig:01 surrounded:98 wrote:01 caml-list:01 parentheses:01 int:01 int:01 declaration:02 incorrect:06 suppose:08 On 4/11/07, Pietro Abate wrote: > Hi all, > I want to write a type like this in camlp4 : > type ('a,'b) b = [ `T of 'b ] > type a = ('b,int) b as 'b > > Suppose I have a list of ctyp [<:ctyp< 'b >>;<:ctyp< int >>; ... ] > How can I write the type ('b,int) b as 'b ?? > > I've tried with <:ctyp< type a = b ($list:l$) as 'b >> but the result > is incorrect ... what is the right syntax ? > Two things: The `as' must be surrounded by parentheses (('b,int) b as 'b). And a type declaration is not a type, you can use a str_item or a sig_item. Here we go: <:str_item< type a = (b ($list:l$) as 'b) >>;; -- Nicolas Pouillard