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/12/07, Pietro Abate <Pietro.Abate@anu.edu.au> wrote:
> On Wed, Apr 11, 2007 at 01:43:48PM +0200, Nicolas Pouillard wrote:
> > 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) >>;;
>
> Doesn't quite work for me... This is my usage pattern.
>
> I've a toplevel <:str_item< type $list:l$ >> where l is a list of
> ((_loc * string),(string * (bool * bool)) list, ctyp ,?? list)
> and ?? list is a list of something that I haven't figure out yet (the
> manual says <:str_item< type $list:sslt$ >>: type declaration).

?? is for constraints on type parameters (you can leave it empty)

> to write type a = (b ($list:l$) as 'b) , I've to give a list l
> of one element as
> ((_loc,"a"),[], <:ctyp< (b ($list:[<:ctyp< 'b >>,<:ctyp< int >>]$) as 'b) >>, [])
>
> My problem is to write the type (('b,int) b as 'b) as a ctyp .

Hum I see it's the type application that is like any other application
in revised.

int list -> list int

(string, int) table -> table string int

<:ctyp< (b 'b int as 'b) >>

Regards,

-- 
Nicolas Pouillard