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

Ganesh Sittampalam ganesh at earth.li
Sun Aug 31 10:04:47 EDT 2008

On Sat, 30 Aug 2008, Ashley Yakeley wrote:

> OK. Let's call it "top-level scope". Haskell naturally defines such a 
> thing, regardless of processes and processors. Each top-level <- would 
> run at most once in top-level scope.
> If you had two Haskell runtimes call by C code, each would have its own 
> memory allocator and GC; IORefs, Uniques and thunks cannot be shared 
> between them; and each would have its own top-level scope, even though 
> they're in the same process.

That sounds more feasible - though it does constrain a plugin 
architecture (in which Haskell code can dynamically load other Haskell 
code) to cooperate with the loading RTS and not load multiple copies of 
modules; this might make linking tricky. There's also the problem Duncan 
Coutts mentioned about loading multiple versions of the same module - what 
are the semantics of <- in relation to that?

Also, it's no use for mediating access to a resource or library that can 
only be accessed once, right? In fact, even without the problem of two 
Haskell runtimes in one process this can't work, since some library in 
another language might also choose to access that resource or library.

What applications does this leave beyond Data.Unique and Random?


More information about the Haskell-Cafe mailing list