From: Michael Walter <michael.walter@gmail.com>
To: skaller@users.sourceforge.net
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] environment idiom
Date: Mon, 13 Dec 2004 04:56:39 -0500 [thread overview]
Message-ID: <877e9a17041213015616bff817@mail.gmail.com> (raw)
In-Reply-To: <1102918715.2768.240.camel@pelican.wigram>
On 13 Dec 2004 17:18:36 +1100, skaller <skaller@users.sourceforge.net> wrote:
> On Mon, 2004-12-13 at 13:45, Michael Walter wrote:
> > > The claims that monadic programming allows side effect
> > > free transparent purely functional encoding is unquestionably
> > > bogus.
> > In your view, would claiming that the stream approach allowed that be
> > bogus as well?
> [..]
> With that idea in mind, any claim that X is transparent is automatically
> bogus without context, you really need to say instead
>
> "X is transparent at the Y level"
Right. But very often (such as in "mine is bigger" <0.5 wink>), the
comparison argument ("the context") is obvious and/or has a typical
meaning: If you say that "monadic programming allows side effect free
transparent purely functional encoding of state", most people will
understand what you are talking about (the State monad allows apparent
stateful computations, but can be purely functionally encoded).
You are stressing a different but no less obvious point of monads, in
this example that a State monad models state (i.e. you have apparent
statefulness *inside* the monad).
> Another example is my Felix language. It has both functions
> and procedures. Functions aren't allowed to have side effects,
> yet they're not pure in the sense the result can depend
> on variables which change between (but not during) invocations.
> [This has an alarming effect on the optimiser ..]
Can I read about the reasoning behind this on felix.sf.net?
> [...] Clearly you can reason about the
> 'functional subsystem' using transparency, and then combine
> the result with reasoning about the top level 'magic main'
> where the program as a whole is not transparent ... and you still
> have 'ease of reasoning' in the combination.
Indeed (and Monads give you an attractive way to partly do this the
other way around).
> Yes, but that is precisely the point. In wishing to avoid
> the kind of hype normally associated with OO and Java,
> I think it is necessary to reconsider exactly what
> crude statements like 'it is pure and transparent' actually
> mean.
Are there specific statements, for instance on the Haskell home page,
which you dislike? Or do you dislike that fact that for instance in
the statement "Monads allow for sideeffect free encoding of stateful
computations" everyone is assuming that "encoding" refers to the
encoding in the target language?
> It was actually *my* statement that I labelled 'unquestionably
> bogus', namely that Haskell (including all monadic programming)
> is pure and transparent (and side effect free) when clearly
> any kind of I/O at the OS level is not.
Okay, I was thinking (along the lines of the paragraph above) that you
were unhappy about the way that people are talking about monads.
> However the claim is not *wrong*, instead I'm claiming
> it isn't a well formed formula: 'pure' is a predicate
> that has to be applied to a particular level of encoding,
> and then you can reason about that level using that
> property.
Okay. So far I have never been confused by such statements about
monads -- it was usually pretty clear what "pure" was referring to (Of
course stateful computations deal with state, that is the very point
of them. But OTOH it is very obvious that calling the State monad
"pure" does not talk about computations *inside* the State monad, but
about the *outside* view -- if you run a computation in the State
monad, the result _purely_ depends on the arguments of runState).
> ... but that isn't enough to reason about correctness,
> since it invariably means checking the program meets some
> specification given at a much higher level of abstraction.
Sure.
> Since I'm not a Haskell programmer it is hard to give examples,
> but for Ocaml I'm sure we all know that some uses of
> imperative programming technique feel 'safer' than others.
> They threaten purity less. But this is just waffle.
> I'd like to have a better guideline.
I'm not an O'Caml programmer but I think I know what you mean.
> Why are localised uses of mutation
> less of a threat to reasoning than less localised ones?
>
> Because it's encapsulated in the function .. but that is
> a waffle explanation .. how about more general
> theoretical account of this phenomena?
Yep. This also seems very natural -- the more localized the (potential
and actual) effects, the easier to reason about (you can reason about
smaller chunks of code, so to say).
4;56 AM-ly yours,
Michael
next prev parent reply other threads:[~2004-12-13 9:56 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 [this message]
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
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=877e9a17041213015616bff817@mail.gmail.com \
--to=michael.walter@gmail.com \
--cc=caml-list@inria.fr \
--cc=skaller@users.sourceforge.net \
/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