[Haskell-cafe] Re: [Haskell] Top Level <-

Ganesh Sittampalam ganesh at earth.li
Tue Sep 2 16:26:58 EDT 2008

On Tue, 2 Sep 2008, Adrian Hey wrote:

> 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"?

Only because I thought it was the running example.

> 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 sigs? :-)

Because I don't use it, and even if I did use it I would just live with 
the API it has.

> 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.

It does actually claim a specification, namely that no two calls to 
newUnique return values that compare equal.

>>> 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 
>> discussion.
> 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".

Thanks. It'd probably be a good addition to the wiki page on this topic 
for these to be catalogued in terms of why they are needed, though I'm 
(probably) not volunteering to do it :-)


More information about the Haskell-Cafe mailing list