Version française
Home     About     Download     Resources     Contact us    
Browse thread
(old) camlp4 question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] (old) camlp4 question
On 4/11/07, Pietro Abate <Pietro.Abate@anu.edu.au> 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