DDC compiler and effects; better than Haskell? (was Re: [Haskell-cafe] unsafeDestructiveAssign?)

Derek Elkins derek.a.elkins at gmail.com
Wed Aug 12 09:34:28 EDT 2009

On Tue, Aug 11, 2009 at 3:51 PM, Robin Green<greenrd at greenrd.org> wrote:
> On Wed, 12 Aug 2009 11:37:02 +0200
> Peter Verswyvelen <bugfact at gmail.com> 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.

More information about the Haskell-Cafe mailing list