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 D9418BB81 for ; Mon, 13 Dec 2004 01:49:05 +0100 (CET) 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 iBD0n5fT025289 for ; Mon, 13 Dec 2004 01:49:05 +0100 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 BAA09030 for ; Mon, 13 Dec 2004 01:49:04 +0100 (MET) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iBD0n2Cp025278 for ; Mon, 13 Dec 2004 01:49:03 +0100 Received: from [192.168.1.200] (ppp203-65.lns1.syd3.internode.on.net [203.122.203.65]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id iBD0mu0r026572; Mon, 13 Dec 2004 11:18:57 +1030 (CST) Subject: Re: [Caml-list] environment idiom From: skaller Reply-To: skaller@users.sourceforge.net To: Michael Walter Cc: William Lovas , caml-list In-Reply-To: <877e9a170412121109ec02d44@mail.gmail.com> References: <9410EC84C0872141B27A2726613EF45D02A52E08@psmrdcex01.psm.pin.safeco.com> <41B97FD7.50309@andrej.com> <1102732237.2611.580.camel@pelican.wigram> <41BB04D8.60405@andrej.com> <20041211181313.GA9656@fichte.ai.univie.ac.at> <1102809398.2611.637.camel@pelican.wigram> <20041212023636.GA12724@force.stwing.upenn.edu> <1102829608.2768.77.camel@pelican.wigram> <877e9a170412121109ec02d44@mail.gmail.com> Content-Type: text/plain Message-Id: <1102898935.2768.88.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 13 Dec 2004 11:48:55 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 41BCE701.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41BCE6FE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 sourceforge:01 wrote:01 sourceforge:01 wrote:01 monadic:01 monads:01 monadic:01 abstraction:01 model:01 ocaml:01 hashtbl:01 glebe:01 061:98 idiom:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: On Mon, 2004-12-13 at 06:09, Michael Walter wrote: > On 12 Dec 2004 16:33:29 +1100, skaller wrote: > > Yes, that indeed is my intention. Basically, any non-transparent > > non-function code can be made purely functional and transparent > > with a simple transformation, yet it doesn't by this transformation > > get any easier to reason about the code. > Well, actually monadic I/O makes is easier to reason about code than > languages which allow for non-transparent side effects in functions. I > think you were making a really good argument pro monads yourself -- in > your C interpreter monad you can easily see what's making use of the C > interpreter (any function "in"/lifted to the C interpreter monad), and > what's not. Same for I/O -- you can assume that only functions > "in"/lifted to the IO monad (simply said, every value of type IO a) > are able to do I/O. This clearly allows easier reasoning about code. This is a good point, and it seems to support my thesis. What you seem to be saying is that in mixed monadic/plain code, the abstraction boundary is plain, which helps reasoning. So the monadic model is good, because it plainly separates the 'purely functional' non-monadic code, from the monadic code, which admits two distinct views -- at the lower level it is pure, whilst the higher level interpretation might not be -- depending both on the monad being used, and also how it is used. Compare with Ocaml which does not localise non-transparent code (using references, Hashtbl, etc). -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net