[Haskell] Re: Global Variables and IO initializers

Jules Bean jules at jellybean.co.uk
Tue Nov 23 10:10:20 EST 2004

On 23 Nov 2004, at 11:53, George Russell wrote:

> I wrote (snipped):
> > 3) It needs no extensions to the Haskell language, and only fairly
> > standard hierarchical libraries like Data.IORef.
> Lennart Augustsson wrote (snipped):
> > It uses unsafePerformIO which is very much an extension to Haskell. 
> :)
> Ben Rudiak-Gould wrote (snipped):
> > I think by Haskell he means the common language currently 
> implemented by
> > GHC and Hugs.
> No.  I mean by the "Haskell language" what is described in
> the Haskell 98 Report.   unsafePerformIO is not part of the language,
> it is a value defined by one of the standard hierarchical libraries.

But it isn't a value, is it? Since it fails referential transparency.

'unsafePerformIO' is not, in the ordinary sense a 'library routine', 
since library routines might ordinarily be expected to preserve haskell 
semantics and program equivalence etc etc. It is a genuine extension to 
the language (and genuinely breaks the language's semantics unless you 
meet the proof obligation, which is not checkable by the compiler).


More information about the Haskell mailing list