From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 02F12BB84 for ; Sun, 11 Jun 2006 04:28:45 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k5B2SfMi015026 for ; Sun, 11 Jun 2006 04:28:41 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA16577 for ; Sun, 11 Jun 2006 04:28:41 +0200 (MET DST) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.171]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k5B2Sdrt032750 for ; Sun, 11 Jun 2006 04:28:40 +0200 Received: from mac.com (smtpin08-en2 [10.13.10.153]) by smtpout.mac.com (Xserve/8.12.11/smtpout01/MantshX 4.0) with ESMTP id k5B2Saqb019433; Sat, 10 Jun 2006 19:28:37 -0700 (PDT) Received: from [192.168.0.161] (dsl092-032-215.lax1.dsl.speakeasy.net [66.92.32.215]) (authenticated bits=0) by mac.com (Xserve/smtpin08/MantshX 4.0) with ESMTP id k5B2SY8g021180; Sat, 10 Jun 2006 19:28:35 -0700 (PDT) In-Reply-To: <44872ABF.2020307@mcmaster.ca> References: <44872ABF.2020307@mcmaster.ca> Mime-Version: 1.0 (Apple Message framework v750) X-Gpgmail-State: !signed Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <76F9DF98-BFD4-4308-9CA2-F0D79BD507B7@mac.com> Cc: caml-list@inria.fr, lvandijk@freenet.de, oleg@pobox.com Content-Transfer-Encoding: 7bit From: Paul Snively Subject: Re: [Caml-list] pa_monad 1.0 - syntax extension for monads Date: Sat, 10 Jun 2006 19:28:18 -0700 To: Jacques Carette X-Mailer: Apple Mail (2.750) X-Miltered: at concorde with ID 448B7FD9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 448B7FD7.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; syntax:01 monads:01 oleg:01 makefile:01 findlib:01 oleg's:01 monadic:01 delimited:01 monads:01 syntax:01 monadic:01 ocaml:01 failwith:01 failwith:01 ocaml's:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Jacques, Lydia, and Oleg, Thanks so much for this! It's almost embarrassing to ask for more, but I'm going to anyway: 1) It isn't clear how to build a native version of the release, although the Makefile appears to contemplate doing so. 2) It would be nice if the release were integrated with findlib. 3) It would be nice if Oleg's monadic delimited continuations were revised to be as nicely supported by pa_monad as the IO, Exception, and Nondet monads that are included with the distribution are. I will poke around at all three of these issues myself. In the meantime, thanks again for a great tool! Best regards, Paul On Jun 7, 2006, at 12:36 PM, Jacques Carette wrote: > We are pleased to announce the release of the stable version our > syntax extension for monadic expressions in Ocaml. > > All the details can be obtained from http://www.cas.mcmaster.ca/ > ~carette/pa_monad/ . > > Example: A simple but realistic example of the use of a list monad > looks like this > > bind > [1; 2; 3] > (fun a -> bind > [3; 4; 5] > (fun b -> return (a + b))) > > where we assume the appropriate definitions of the functions "bind" > and "return". With the help of "pa_monad" this can be written as > > perform > a <-- [1; 2; 3]; > b <-- [3; 4; 5]; > return (a + b) > > which is much clearer and thus easier to understand and maintain. > By the way, the expression evaluates to [4; 5; 6; 5; 6; 7; 6; 7; 8] > the sum of each pair of values of the input lists. > > Highlights: > > - Efficient code: The generated code is as efficient as hand-coded. > - Highly flexible: The "bind" and "failwith" functions can be > specified in various ways > (a) Binding with default names: > perform ... > (b) Binding with user-defined names: > perform with my_bind and my_failwith in ... > (c) One-of-a-kind binding: > perform with fun a f -> f a and ... in ... > (d) Module-based binding: > perform with MyMonad in ... > or with OCaml's local modules: > let foo ... = > let module MyMonad = ... in > perform with MyMonad in ... > > The package for this extension contains more examples as well as > some self-tests and an extensive README with yet more details > (including a patch to tuareg-mode). In the source code (and the > generated ocamldoc html), one can find amongst other things an > informal and formal description of the grammar of the extension, > and a (rewriting) semantics for the extension. > > This code is licensed under the GNU library general public license, > compatible with Ocaml's own license. > > All feedback welcome, > Jacques Carette, Lydia E. van Dijk and Oleg Kiselyov > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs