From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 5FDEFBC69 for ; Tue, 31 Jul 2007 18:55:19 +0200 (CEST) Received: from smtp4-g19.free.fr (smtp4-g19.free.fr [212.27.42.30]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6VGtJl2016726 for ; Tue, 31 Jul 2007 18:55:19 +0200 Received: from smtp4-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp4-g19.free.fr (Postfix) with ESMTP id E68C28426 for ; Tue, 31 Jul 2007 18:55:18 +0200 (CEST) Received: from kerneis.info (kerneis.info [82.224.215.18]) by smtp4-g19.free.fr (Postfix) with ESMTP id C5E506F3B4 for ; Tue, 31 Jul 2007 18:55:18 +0200 (CEST) Received: from localhost ([127.0.0.1] helo=tatanka.kerneis.info ident=gabriel) by kerneis.info with esmtp (Exim 4.63) (envelope-from ) id 1IFv09-00041N-5v for caml-list@yquem.inria.fr; Tue, 31 Jul 2007 18:55:17 +0200 Date: Tue, 31 Jul 2007 18:55:05 +0200 From: Gabriel Kerneis To: caml-list@yquem.inria.fr Subject: [Camlp4][trivial ?] Anonymous bind (for monads) Organization: ENST X-Mailer: Claws Mail 2.10.0 (GTK+ 2.10.13; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_hdo=MFtA2zylLTUsk9P3xEG"; protocol="application/pgp-signature"; micalg=PGP-SHA1 Message-Id: X-Miltered: at discorde with ID 46AF6977.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 trivial:01 monads:01 camlp:01 ocaml:01 struct:01 syntax:01 sig:01 syntax:01 struct:01 expr:01 expr:01 foo:01 ocaml:01 ocamlc:01 X-Attachments: type="application/pgp-signature" name="signature.asc" name="signature.asc" --Sig_hdo=MFtA2zylLTUsk9P3xEG Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello, I've got a little problem with camlp4. The following works perfectly well : ##################################################################### ~/ocaml/camlp4% cat pa_bind.ml module Id =3D struct let name =3D "pa_bind" let version =3D "$Id:$" end module Example (Syntax : Camlp4.Sig.Camlp4Syntax) =3D struct include Syntax EXTEND Gram expr: LEVEL "top" [[ t=3Dexpr; "foo"; f=3Dexpr -> <:expr< Lwt.bind $t$ (fun () -> $f$) =20 >>]]; =20 END end module M =3D Camlp4.Register.OCamlSyntaxExtension(Id)(Example) ~/ocaml/camlp4% ocamlc -c -pp camlp4of -I +camlp4 pa_bind.ml=20 ~/ocaml/camlp4% cat test_bind.ml=20 let r =3D (Lwt_unix.sleep 5) foo (print_endline "42") ~/ocaml/camlp4% camlp4of -parser pa_bind.cmo test_bind.ml=20 let r =3D Lwt.bind (Lwt_unix.sleep 5) (fun () -> print_endline "42") ##################################################################### 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? Thanks a lot. Regards, --=20 Gabriel --Sig_hdo=MFtA2zylLTUsk9P3xEG Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGr2lx6a2JmXQu5bYRAqC9AKDJKdH5hye87ru+9F7WpxJ1EMxplACcCaN7 tsgh0jzM0f1zhG2hxf/L3dw= =conS -----END PGP SIGNATURE----- --Sig_hdo=MFtA2zylLTUsk9P3xEG--