[Haskell] threading mutable state through callbacks

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Oct 12 06:34:28 EDT 2004

"Simon Marlow" <simonmar at microsoft.com> writes:

> I'd like to add that while the implementation might be a little unsafe,
> there's no problem in principle with the semantics of top-level IORefs.
> We could add such a thing as a GHC extension, but it would be nice if it
> were an instance of a more general-purpose extension.

Top-level MVars also make sense, the extension should not be limited
to IORefs. But permitting arbitrary values makes unsafePerformIO
official and opens a hole in the type system for polymorphic variables
(can such polymorphism be hidden in an apparently monomorphic datatype?).

   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/

More information about the Haskell mailing list