Alastair David Reid
18 Sep 2001 16:22:10 -0600
Leon Smith <email@example.com> writes:
> My intuition says that none of the side-effects in my implementation
> are visible from the abstract level of the module. However, the use
> of unsafePerformIO certainly modifies the behaviour of the module.
Here's a simple test you can apply:
Can you rewrite your module in pure Haskell so that it has the
same observed behaviour but (probably) different operational
behaviour (e.g. space and time usage)?
If the answer is yes, then you preserve referential transparency, type
safety and other desirable properties (on the assumption that pure
Haskell has these properties).
If the answer is no, you've probably broken one or more important
properties. (There may still be hope but you might have to get very
devious (cf. non-determinism in Rittri et al.'s UniqueSupply, Hughes
and O'Donnell's non-determism monad and exception handling).)
Alastair Reid firstname.lastname@example.org http://www.cs.utah.edu/~reid/