Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2007-04-12 (01:20)
From: Pietro Abate <Pietro.Abate@a...>
Subject: Re: [Caml-list] (old) camlp4 question
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).

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 .

I want to write it in this way as both l and the list of type variables
in (('b,int) b as 'b) are not fixed. Moreover types in <:str_item<
type $list:l$ >> can be mutually recursive.

thanks :)

++ Blog:
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.