Browse thread
[Camlp4][trivial ?] Anonymous bind (for monads)
-
Gabriel Kerneis
- Nicolas Pouillard
- Gabriel Kerneis
- Julien Moutinho
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Julien Moutinho <julien.moutinho@g...> |
| Subject: | Re: [Caml-list] [Camlp4][trivial ?] Anonymous bind (for monads) |
On Tue, Jul 31, 2007 at 06:55:05PM +0200, Gabriel Kerneis wrote: > EXTEND Gram > expr: LEVEL "top" > [[ t=expr; "foo"; f=expr -> > <:expr< > Lwt.bind $t$ (fun () -> $f$) > >>]]; > END > end > [...] > But if I change "foo" to ">>" (which is the usual way to write an > anonymous bind for monads), it doesn't work anymore. I first thought the > reason was that ">>" is also the symbol for closing a quotation, but > trying "++" instead proved useless as well. > > I'm certainly not a camlp4 guru so... what am I missing? My guess is that the first [t=expr] swallows the ">>". You can try "->" or "|" against which [expr] does not match, but I think it is not advisable to use them in a bigger program. However, I'm sure that Mr.Pouillard will be happy to enlight us on how to use ">>". HTH a little.