caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Thomas Fischbacher <Thomas.Fischbacher@Physik.Uni-Muenchen.DE>
Cc: Michael Walter <michael.walter@gmail.com>,
	caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] environment idiom
Date: 13 Dec 2004 22:46:32 +1100	[thread overview]
Message-ID: <1102938392.2578.138.camel@pelican.wigram> (raw)
In-Reply-To: <Pine.LNX.4.58.0412130947100.13773@eiger.cip.physik.uni-muenchen.de>

On Mon, 2004-12-13 at 19:56, 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.
> 
> Of course, it's possible to just forget about all that and fall back to 
> transliterating imperative code to IO monad code,

Right. So, how can you distinguish these two ways of programming?

I'm not claiming purity, transparency, or monads are bad,
contrarily it's great stuff! But as usual, with greater power
you lose something.

> It's just the same with Haskell and the IO monad.

So again the question is -- can you *characterise* better,
the good uses and the bad ones? Perhaps you can do this
by examining the higher order abstraction being implemented
and see if that is transparent or not?

With Haskell you have a *formalised* system for building
combinators (unlike Ocaml where you can still make them,
but it's a technique, not a language feature).

Given that you can probably formalise the properties
of the machinery you can build with them. The ST monad
is so powerful it provides a general way to do procedural
programming .. IMHO that isn't at all bad. Not all procedural
code is bad :) But the same caveats probably apply to both
ordinary procedural code and a monadic version.

The main diffence is probably that *todays* Haskell programmers
will probably use the monad sparingly, making as much code
ordinary functional code as possible.

But if you go around yelling 'FP is the magic bullet'
and then 'Haskell can do procedural programming too -- but
it is magical, when you do it is makes procedural code
referentially transparent' .. then what happens?

You'll get people that literally translate C code into
ST monadic Haskell mechanically and claim their code
is better now .. :)

Anyhow I don't wish to argue that monads or FP is bad,
contrarily, I would like to learn more how to properly
characterise properties like transparency -- the ST monad
(and IO) clearly show that you can simultaneously have
and not have transparency, purity, etc depending on 
your view. So perhaps you can help define what I mean
by view .. because I only have a vague intuition what
it means.

-- 
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




  parent reply	other threads:[~2004-12-13 11:46 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-09  2:07 HENRIKSON, JEFFREY
2004-12-09  4:47 ` [Caml-list] " Jacques Garrigue
2004-12-09  6:02   ` Michael Walter
2004-12-09 11:28     ` Jacques Garrigue
2004-12-09 20:02     ` pad
2004-12-09 23:11       ` Jacques Garrigue
2004-12-10  2:30         ` skaller
2004-12-09  9:09 ` Richard Jones
2004-12-09 13:12   ` [Caml-list] " Ville-Pertti Keinonen
2004-12-10 11:59     ` Richard Jones
2004-12-10 10:52 ` [Caml-list] " Andrej Bauer
2004-12-10 12:13   ` Richard Jones
2004-12-10 23:35     ` Jacques Garrigue
2004-12-11  2:30   ` skaller
2004-12-11 14:31     ` Andrej Bauer
2004-12-11 18:13       ` Markus Mottl
2004-12-11 23:56         ` skaller
2004-12-12  2:36           ` William Lovas
2004-12-12  5:33             ` skaller
2004-12-12 19:09               ` Michael Walter
2004-12-13  0:48                 ` skaller
2004-12-13  2:03                   ` Michael Walter
2004-12-13  2:05                     ` Michael Walter
     [not found]                       ` <877e9a170412121844b633bb8@mail.gmail.com>
2004-12-13  2:45                         ` Michael Walter
2004-12-13  6:18                           ` skaller
2004-12-13  7:08                             ` skaller
2004-12-13  9:56                             ` Michael Walter
2004-12-13 12:59                               ` skaller
2004-12-13  8:56                           ` Thomas Fischbacher
2004-12-13  9:21                             ` Jacques Garrigue
2004-12-13 10:05                               ` Michael Walter
2004-12-13 10:29                                 ` Thomas Fischbacher
2004-12-13 21:16                                   ` Michael Walter
2004-12-13 10:20                               ` Thomas Fischbacher
2004-12-13 12:09                                 ` Jacques Garrigue
2004-12-13 12:48                                   ` Thomas Fischbacher
2004-12-13 14:09                                   ` skaller
2004-12-13 21:39                                     ` Michael Walter
2004-12-13 13:22                                 ` skaller
2004-12-13 16:54                                   ` Marcin 'Qrczak' Kowalczyk
2004-12-13 18:44                                   ` Thomas Fischbacher
2004-12-13 10:11                             ` Michael Walter
2004-12-13 11:46                             ` skaller [this message]
2004-12-13  5:41                     ` skaller
2004-12-13  9:29                       ` Michael Walter
2004-12-13 12:30                         ` skaller
2004-12-13 13:49                           ` Martin Berger
2004-12-12 23:03           ` Thomas Fischbacher
2004-12-13  1:26             ` skaller
2004-12-13  8:37               ` Thomas Fischbacher
2004-12-13 10:53                 ` skaller
2004-12-13 11:38                   ` Martin Berger
2004-12-13 13:33                     ` skaller
2004-12-13 12:01                   ` Thomas Fischbacher
2004-12-13 13:41                     ` skaller
2004-12-11 23:29       ` skaller
2004-12-12  0:21         ` Jacques Carette

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1102938392.2578.138.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=Thomas.Fischbacher@Physik.Uni-Muenchen.DE \
    --cc=caml-list@inria.fr \
    --cc=michael.walter@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).