Version française
Home     About     Download     Resources     Contact us    
Browse thread
Camlp4 quotations for tuples
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Philippe Veber <philippe.veber@g...>
Subject: Re: Camlp4 quotations for tuples
Self-answer, though I'm not sure that's the prettiest way (not even sure it
is even valid) :

<:ctyp< ($Ast.tySta_of_list tuple_types$) >>

ph.


2009/7/28 Philippe Veber <philippe.veber@googlemail.com>

> Hi list,
>
> Does someone know how to write a camlp4 quotation for types of the form 'a
> * 'b * 'c * 'd ...  For now I could only obtain types of the form 'a * ('b *
> ('c * ('d * ... )...))), using a code similar to
>
>
>  List.fold_right
>    (fun x accu -> <:ctyp< $x$ * $accu$ >>)
>    (List.tl tuple_types)
>    (List.hd tuple_types)
>
>
> TIA,
> ph.
>
>