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

Adrian Hey ahey at iee.org
Mon Sep 1 09:17:37 EDT 2008


Adrian Hey wrote:
> 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 and plenty of people have found that other libs/ffi
> bindings need them for safety reasons. Or at least they need something
> that has "global" main/process scope and so far the unsafePerformIO hack
> is the only known way to get that and still keep APIs stable,sane and
> modular.

Actually all this use of the tainted and derogatory term "global
variable" is causing me to be imprecise. All MVars/IORefs have "global" 
main/process scope whether or not they're bound to something at the
top level.

The purpose of the top level static binding is to prevent accidental
or malicious "state spoofing" if it's important that the *same*
IORef/MVar is always used for some purpose.

Regards
--
Adrian Hey


More information about the Haskell-Cafe mailing list