Re:Imperative Haskell
by ridiculous_fish on Wednesday May 31, 2017 @06:33AM
(#14451469)
Is a function like trace pure in your definition? trace's side effects seem to fall into the "unobservable implementation detail" category next to the missile launches.
[ Parent
| on HN ]
It's not observable to the calling function (the return value didn't change) so it doesn't count.
Perhaps a way to think about it is as a way defining the contract between a library function and its callers regarding what substitutions are permissible. For example, substituting a faster algorithm is likely observable to the end user, but the calling function will continue to return the same value so it's a compatible substitution.
Similarly, turning on compiler optimizations or debug logging should not be a correctness issue, though it certainly matters or we wouldn't do it.