From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id B49F0BDCC for ; Mon, 22 Aug 2005 20:21:27 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j7MILRiY029862 for ; Mon, 22 Aug 2005 20:21:27 +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 UAA01498 for ; Mon, 22 Aug 2005 20:21:26 +0200 (MET DST) Received: from cgpsrv2.cis.mcmaster.ca (univmail.CIS.McMaster.CA [130.113.64.46]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j7MILP6w013434 for ; Mon, 22 Aug 2005 20:21:26 +0200 Received: from [130.113.68.27] (account carette@univmail.cis.mcmaster.ca [130.113.68.27] verified) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro SMTP 4.1.8) with ESMTP id 101783537 for caml-list@inria.fr; Mon, 22 Aug 2005 14:21:24 -0400 Message-ID: <430A17AC.90303@mcmaster.ca> Date: Mon, 22 Aug 2005 14:21:32 -0400 From: Jacques Carette User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Which syntax is more ocaml-like? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 430A17A7.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 430A17A5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; syntax:01 ocaml-like:01 oleg:01 monadic:01 syntax:01 ocaml:01 caml-list:01 caml-list:01 monads:01 foo:01 foo:01 functors:01 ocaml-like:01 ...:98 ...:98 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 Hello, with Oleg Kiselyov, we are working on a better version of the monadic do syntax for Ocaml (the original message http://caml.inria.fr/pub/ml-archives/caml-list/2005/03/87cab0cdbbcfcf736b85d746ba610e78.en.html did not come through on the arhive, see https://mailman.rice.edu/pipermail/metaocaml-users-l/2005-March/000056.html for the same email but with the attachment intact. http://caml.inria.fr/pub/ml-archives/caml-list/2005/05/e85edd2308a0e58a7b0761962bc440c6.en.html is also relevant). In particular, we want to handle multiple monads. Variations on two different themes have come up as possibilities: 1) doM Foo { ... } 2) doM with Foo in ... (where the 'with' could be dropped altogether). For example if the ... above was a <- m; return a then both of these would expand to Foo.bind m (fun a -> return a) The reason to use a module (with just one export) is for future extensibility, where we may want to require more functions of the Monad implementation; also, as has been demonstrated here and there, there are nice morphisms between ML-stype modules/functors and Haskell-stype type classes. There could also be a special case with no Foo at all, which would then use the bind function in the current scope (if any). Which of 1) or 2) above is more Ocaml-like? Other comments? Jacques