[Haskell-cafe] Re: [Haskell] Top Level <-
ahey at iee.org
Tue Sep 2 03:15:04 EDT 2008
Ganesh Sittampalam wrote:
> You see this as a requirement that can be discharged by adding the ACIO
> concept; I see it as a requirement that should be communicated in the type.
> Another way of looking at it is that Data.Unique has associated with it
> some context in which Unique values are safely comparable. You want that
> context to always be the top-level/RTS scope, I would like the defining
> that context to be part of the API.
But why pick on Data.Unique as special? Because I just happened to have
pointed out it uses a "global variable"? If you didn't know this I
suspect this issue just wouldn't be an issue at all. Why haven't you
raised a ticket complaining about it's API having the "wrong" type
There's shed loads of information and semantic subtleties about pretty
much any operation you care to think of in the IO monad that isn't
communicated by it's type. All you know for sure is that it's weird,
because if it wasn't it wouldn't be in the IO monad.
So I think you're applying double standards.
>> We have to have something concrete to discuss and this is the simplest.
>> Like I said there are a dozen or so other examples in the base package
>> last time I counted
> Would you mind listing them? It might help provide some clarity to the
Here's what you can't find in the libs distributed with ghc. Note this
does not include all uses of unsafePerformIO. It only includes uses
to make a "global variable".
In the ghc source you can find 16 uses of the GLOBAL_VAR macro (can't
imagine what that does :-).
I didn't even attempt to figure out how global variables might be the
rts source. Anyone care to hazard a guess?
You can find a few more in the extra libs..
A few more:
SDL 0 !!
However, I happen to know that SDL suffers from the initialisation
issue and IIRC it needs at least 1 global to stop user using an unsafe
(possibly segfault inducing) calling sequence.
Anyway, that's all from me because I'm bored with this thread now.
More information about the Haskell-Cafe