more unsafePerformIO questions (is it safe to use with ReadMode Handles)?

Simon Marlow simonmar@microsoft.com
Tue, 19 Aug 2003 10:52:57 +0100


=20
> >If the databases *do* change over time, then there are two
> >possibilities:
> >
> >  1. the contents change due to external factors only
> >  2. the contents change because this program doing the writing
> >
> >in (1), you can still pretend the interface is pure, by=20
> imagining that
> >all the changes happened earlier.  This works as long as you=20
> only read
> >the external data once.
>=20
> Isn't there the possibility of inlining causing a read to=20
> happen twice even if it only appears to happen once?

In theory that would be a valid transformation, but in practice no
compiler would duplicate arbitrary computations.  GHC certainly doesn't.

Cheers,
	Simon