
On Tue, Aug 11, 2009 at 3:51 PM, Robin Green
On Wed, 12 Aug 2009 11:37:02 +0200 Peter Verswyvelen
wrote: Yes, sorry.
But I think I already found the answer to my own question.
DDC functions that are lazy don't allow side effects: http://www.haskell.org/haskellwiki/DDC/EvaluationOrder
Anyway it would be cool if the DDC EffectSystem would also work on lazy functions :)
As was just pointed out in the unsafeDestructiveAssign thread from which this thread was forked, effects are incompatible with non-strict evaluation.
No, they aren't. At least, they aren't in any technical way. There have been more than a few languages supporting both laziness and mutation starting with Algol.
The compiler is supposed to be able to reorder non-strict evaluation to do optimisations, but that can't be done if effects could happen.
There's nothing special about non-strict evaluation that makes the antecedent true. Replacing "non-strict" with "strict" gives just as much of a valid statement. It is purity that allows (some) reordering of evaluation.
Also, effects would destroy modular reasoning.
Again, it is purity, not laziness, that allows compositional reasoning. Effects destroy compositional reasoning in a strict language just as much.