From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 6B8A7BCAB for ; Wed, 11 May 2005 16:14:18 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j4BEEHlE019780 for ; Wed, 11 May 2005 16:14:17 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA04178 for ; Wed, 11 May 2005 16:14:17 +0200 (MET DST) Received: from cgpsrv2.cis.mcmaster.ca (cgpsrv2.CIS.McMaster.CA [130.113.64.62]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j4BEEG7J019775 for ; Wed, 11 May 2005 16:14:16 +0200 Received: from [24.43.193.126] (account carette@univmail.cis.mcmaster.ca) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro WebUser 4.1.8) with HTTP id 92066943; Wed, 11 May 2005 10:14:15 -0400 From: "Jacques Carette" Subject: Re: [Caml-list] Monads-Module for the Standard-OCaml-Distribution?! To: Oliver Bandel , Inria Ocaml Mailing List X-Mailer: CommuniGate Pro WebUser Interface v.4.1.8 Date: Wed, 11 May 2005 10:14:15 -0400 Message-ID: In-Reply-To: <20050511100831.GA490@first.in-berlin.de> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format="flowed" Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 42821339.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42821338.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 caml-list:01 monads:01 monadic:01 notation:01 notation:01 monads:01 monadic:01 ocaml:01 haskell:01 haskell:01 confines:01 typeclass:01 syntactic:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.9 required=5.0 tests=PLING_QUERY autolearn=disabled version=3.0.2 X-Spam-Level: I definitely support the inclusion of Monad-related features to Ocaml. However, without some syntactic sugar, this is rather difficult to use. I have discussed this in a previous message to this list [which unfortunately cannot be retrieved from the caml-list archives because somehow multipart/MIME messages are not handled properly by the archiver]. However, it is archived here: https://mailman.rice.edu/pipermail/metaocaml-users-l/2005-March/000056.html The camlp4 extension above has some flaws (as pointed out to me by Lydia van Dijk): 1) extra { } that are not needed 2) which monad is used is unclear 3) using multiple monads in the same program is difficult Very helpfully, Lydia has provided me with an updated version of pa_monad.ml that fixes these. I unfortunately have not had the time to convert all my monadic programs to this new notation - as a "real" test that the new notation does work. As soon as I confirm this, I will send an email to caml-list with this improved notation. Having a standard library of Monads that can easily be used with a monadic 'do' notation in Ocaml would definitely be very nice. Interestingly, here Ocaml can do something which cannot be done in Haskell: it is possible to use the object system to encapsulate Monads in a novel way. Because objects are first-class in Ocaml, a lot more can be done with them than in Haskell, where one must live within the confines of the typeclass system for manipulating Monads. While I have not explored this enough, 'Monad Transformers' could become much easier to do in Ocaml than in Haskell! Jacques