Derek Elkins wrote:
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.
Here are two effectful statements that can safely be reordered.

 print "foo"
 x := 5


here are two more

 y := 2
 z := 3

(provided y and z don't alias)


Purity allows some reordering of evaluation, so does knowing that
two effectful computations won't interfere.


Ben.



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to