by implicit · 11y ago · 0 comments
This property continues to hold, even as the application and the tests are modified by developers who do not even fully know what sort of effects they should otherwise be concerned with.
For instance, most programming platforms give you pretty ready access to a pseudo-random number generator. This is great until some well-intentioned new hire checks in code someplace that uses it to instrument something 1 out of 1000 runs.
We can't have this problem in Haskell and we don't have to spend any ongoing code review hours on it. It's gone.
True, the security manager does not limit access to the random-number generator, but this, too, can be done with an extra bit of one-time effort, by injecting a security check into the random number generator's seed generation method (we still want to allow fixed seeds like StdGen).
[1]: Or a finer-grained policy of "no IO except for logging".
You can then use the security manager during the test to verify that all IO calls are indeed mocked.