[Haskell-cafe] Re: ACIO versus Execution Contexts

George Russell ger at informatik.uni-bremen.de
Wed Dec 1 08:44:47 EST 2004

Adrian wrote (snipped):
 > But if top level MVars are all that's on offer I'd settle for that :-)
 > I can still implement my "oneShot" examples just by passing the top
 > level MVar as an argument to oneShot rather than having it create its
 > own.

I am not sure which the oneShot examples are, but I suspect you can
implement them just as well using the execution contexts I have proposed.
If you want to be sure your data will not be clobbered by other modules,
simply wrap the state in special type, and make sure no-one else has
access to that type.  This requires no change to the Glasgow Haskell
language at all, only a new library module.

I suppose it may happen that you are worried about someone using withEmptyDict
to create an inner execution context where everything starts from
scratch, because you want to interface with broken C libraries which
are stateful.  However since this is a problem caused by broken C libraries
rather than anything in Haskell, surely it would be better to support this
by providing a global dictionary to be used in such exceptional cases, while
leaving execution contexts the preferred tool in the Haskell world.

More information about the Haskell-Cafe mailing list