Version française
Home     About     Download     Resources     Contact us    
Browse thread
polymorphic variants and camlp4
[ 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] polymorphic variants and camlp4
On 2/12/07, Pietro Abate <Pietro.Abate@anu.edu.au> wrote:
> Hi all,
>
> What is the syntax to use polymorphic variants with camlp4 ?

It depends what you mean by "with camlp4", but I suppose you mean
"what is the revised syntax for polymorphic variants ?".

> <:str_item< type a = A >> is ok, but <:str_item< type a = [ `A ] >>

<:str_item< type a = A >> is not really ok neither

try <:str_item< type a = A | B >> to see that's not ok, the grammar
just accept it as an alias.

The syntax for classic variants is <:str_item< type a = [ A | B of int
and int | C of (int * int) ] >>

For polymorphic ones it's <:str_item< type a = [ = A | B ] >>

> doesn't work as expected...

Yes but you expected the original syntax for types declaration.

-- 
Nicolas Pouillard