[Haskell] Real life examples

George Russell ger at informatik.uni-bremen.de
Thu Nov 25 03:54:41 EST 2004

John Meacham wrote (snipped):
 > George Russell's library is precicly an invalid use of unsafePerformIO.
 > Internally, it does the invalid unsafePerformIO (newIORef) trick which
 > is exactly the problem we are trying to solve. hiding it in a module doesn't
 > make it go away.
Why does it matter to you if it uses unsafePerformIO, so long as you are
protected from all the unsafe consequences?

Would you be happier if I required all values to instance (Read,Show) and
then implemented exactly the same interface with this additional restriction
using completely standard Haskell 98 by writing values to files and reading
them back again?

 > I am not positive, but it also would also add the overhead of a
 > finitemap lookup across all global variables for every look up. which
 > doesn't really meet efficiency requirements. a global counter should
 > only need a single peek poke to a constant location, not some data
 > structure lookup.

Oh really, we're not arguing about efficiency at this stage of the game
are we?  Actually you could implement the whole thing with a single
hash table.  I would have done, if TypeRep and ThreadId exposed their
internal integer contents for hashing purposes.

More information about the Haskell mailing list