Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
environment idiom
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-12-13 (08:37)
From: Thomas Fischbacher <Thomas.Fischbacher@P...>
Subject: Re: [Caml-list] environment idiom

On Mon, 13 Dec 2004, skaller wrote:

> > > So monadic programming with state transformers is NOT
> > > referentially transparent or purely functional at all.
> > 
> > Actually, it is. :-)
> Actually it is pointless after I took the trouble
> to explain why this is not the case, to make such
> a bland statement. 

Then let me re-formulate it in other words:

I think you do not yet fully appreciate the key point concerning the 
monadic approach.

Or in still other words: could you please show me a piece of haskell 
code that uses monads but is not referentially transparent (assuming you 
do not use "unofficial" features such as, in particular, unsafePerformIO)?

What I want to see in particular is a few lines of haskell, where X=Y 
holds, but the semantics of the program change if I substitute the 
definition of X with that of Y.

regards,                   (o_
 Thomas Fischbacher -  //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)