[clean-list] Clean in the Real World

Simon Marlow simonmar@microsoft.com
Tue, 16 Dec 2003 09:45:51 -0000


 
> You will:
> (a) be able to apply equational reasoning within your program, in the 
> sense that if an exception occurs within foo, it will always deliver 
> the same result (baz), because it will always throw the same 
> exception, by virtue of the compiler generating a fixed evaluation 
> order for bar. If no exception occurs, everything will be as usual 
> and bar gets returned (but also see below).
> (b) have compiler optimisations both in bar and baz, as it does not 
> matter which exception gets thrown in bar, as long as it is the same 
> one each time within a single program.

I think you've missed the point here.  Yes, you can still use equational
reasoning in your system, but there are now fewer equations which are
valid.  For example, previously I had the equation

	a + b  =  b + a

but now this doesn't apply.  If you don't put the exception catcher in a
nondeterminism monad (or similar), then your language ends up with fewer
equational properties.  This is precisely what we went to great lengths
to avoid in Haskell.

Cheers,
	Simon