Tom Schrijvers wrote: >> I understand that, depending on what the compiler does the result of : >> >> do >> let f = (*) 2 >> print $ serialise f >> >> might differ as, for example, the compiler might have rewritten f as >> \n -> >> n+n. >> >> But, why would that make equational reasoning on serialise not valid? >> >> Isn't that true for all functions in the IO monad that, even when >> invoked with the same arguments, they can produce different results? > > Not if you take the ``state of the world" to be part of the arguments. > If two programs behave differently for the same arguments and the same > state of the world, then they're not equivalent. You do want your > compiler to preserve equivalence, don't you?
You can put the internal representation of the argument into the "state of the world". Regards, apfelmus _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe