Version française
Home     About     Download     Resources     Contact us    
Browse thread
Camlp4: type declaration quotation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dmitry.bely@g...>
Subject: Camlp4: type declaration quotation
Suppose I have

EXTEND Gram
  str_item:
    [ [ "type"; tdl = LIST1 type_declaration SEP "and" ->
...

How to de-construct tdl elements? Specifically I would like to get the
same type here as with the old Camlp4. I am thinking of something like

let tdl = List.map (fun [<:ctyp< type ... >> -> ... | _ -> assert False]) tdl in
...

But how to use <:ctyp< type ... >> ? The only mention in the docs is

<:ctyp< type t 'a 'b 'c = t constraint t = t constraint t = t >>
Type declaration
TyDcl of Loc.t and string and list ctyp and ctyp and list (ctyp * ctyp)

Can you explain what it means and give any example?

- Dmitry Bely