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 (10:53)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] environment idiom
On Mon, 2004-12-13 at 19:37, Thomas Fischbacher wrote:

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

I think most of the theoreticians don't either.

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

I can't do enough Haskell yet, give me a few days :)

Consider this language:

	Registers R0-R15,PC
	Three address form: R1=R2 op R3
	Some conditionals ..

I.e. a simplified Assembler.

Is assmebler code functional?

No of course not!

Yes of course it is! Is is nothing more
than a function from registers to registers where
the instructions guarrantee you can't access the prior state.
That's just the state monad .. :)

The point really is: what do you mean by purely functional?
I think the answer depends on context.

I'm sure you can implement this machine using the ST monad...

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language