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 07582BB81 for ; Mon, 13 Dec 2004 11:11:30 +0100 (CET) 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 iBDABTiK014250 for ; Mon, 13 Dec 2004 11:11:29 +0100 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 LAA24237 for ; Mon, 13 Dec 2004 11:11:29 +0100 (MET) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.200]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBDABSD0014244 for ; Mon, 13 Dec 2004 11:11:28 +0100 Received: by rproxy.gmail.com with SMTP id r35so1094979rna for ; Mon, 13 Dec 2004 02:11:28 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=soie7WUz+CW0uFlK0RSlIXC5j75DoX6M9eSL3WxGzZjSo3QdaAHcmFd83zyuzZKXi9YIysQGdJfwEa65XS0XtgBRl5iTleoNO+hDEMHazpjt6CwyswDcsIVQvX9pzcTF8CwhokKC8J/otiCJ1yC/eKR7PGVc3pdtSkrccGruH6s= Received: by 10.38.71.51 with SMTP id t51mr2477114rna; Mon, 13 Dec 2004 02:11:28 -0800 (PST) Received: by 10.38.86.10 with HTTP; Mon, 13 Dec 2004 02:11:27 -0800 (PST) Message-ID: <877e9a17041213021129cc0aae@mail.gmail.com> Date: Mon, 13 Dec 2004 05:11:27 -0500 From: Michael Walter Reply-To: Michael Walter To: Thomas Fischbacher Subject: Re: [Caml-list] environment idiom Cc: caml-list In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <9410EC84C0872141B27A2726613EF45D02A52E08@psmrdcex01.psm.pin.safeco.com> <20041212023636.GA12724@force.stwing.upenn.edu> <1102829608.2768.77.camel@pelican.wigram> <877e9a170412121109ec02d44@mail.gmail.com> <1102898935.2768.88.camel@pelican.wigram> <877e9a17041212180365f76e4a@mail.gmail.com> <877e9a170412121805295e4704@mail.gmail.com> <877e9a170412121844b633bb8@mail.gmail.com> <877e9a1704121218456af9df9@mail.gmail.com> X-Miltered: at nez-perce with ID 41BD6AD1.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41BD6AD0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 wrote:01 wrote:01 abstraction:01 algebra:01 haskell:01 monadic:01 lends:01 cheers:01 ...:98 idiom:01 imperative:01 imperative:01 unsafe:01 physik:02 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=RCVD_BY_IP autolearn=disabled version=3.0.0 X-Spam-Level: On Mon, 13 Dec 2004 09:56:55 +0100 (CET), Thomas Fischbacher wrote: > On Sun, 12 Dec 2004, Michael Walter wrote: > > > Again I believe we are talking about different kinds of "purity". > > Thomas is obviously right in that the StateTransformer monad (modulo > > unsafe conversions) is pure, you are obviously right in the > > (different) point that _running_ an IO fragment has side effects. > > The key issue is: by not doing I/O, but talking about plans how to do I/O, > you go to a higher level of abstraction that allows you to do magic with > such plans which you just plainly miss if you only know the imperative > ways. It's just like everyone knows how to add (i.e. arithmetics), but > once you learned to talk about properties of addition (i.e. algebra), you > have a much richer point of view that allows you to do quite miraculous > things. Fully agreed. > Of course, it's possible to just forget about all that and fall back to > transliterating imperative code to IO monad code, but it is just as well > possible to find the sum of all the numbers from 1 to 1000 using the > following piece of Maple code: > [...] > One surely can do this, and many people work in such a way to solve > such problems, as they are used to it, but considering the power that > Maple offers you, this is nothing but gross abuse of the system. > > It's just the same with Haskell and the IO monad. Yeah exactly. That's also similar to what I was trying to say in another post above -- idiomatic monadic I/O lends itself to composition. Cheers, Michael