[Haskell-cafe] Execution Contexts
Ian.Stark at ed.ac.uk
Ian.Stark at ed.ac.uk
Sat Nov 27 11:10:26 EST 2004
On Sat, 27 Nov 2004, Benjamin Franksen wrote:
> An execution context is a mutable finite map from types to (monomorphic)
> values. Each IO action implicitly carries exactly one such map and by default
> passes it on to the actions that follow.
Execution contexts sound a good description of them. Building on your
recoding of this, if you have top-level declarations of newMVar / newIORef
then how much of this can you do by just keeping a dictionary in a global
variable? This should certainly save some of the StateT plumbing; and
such declarations are safe, becuase they are affine central (see
http://groups.google.com/groups?selm=fa.doh68b9.96sgjd%40ifi.uio.no )
> A function is provided to (implicitly) create a new mapping and run a
> given IO action with the new mapping as its execution context, instead
> of the default one.
Update the global MVar, do the IO, then reset it?
> I am almost sure that even the trick of indexing the dictionary via
> types (and thus the dependency on Data.Typeable and ghc extensions) can
> be avoided with a little more effort.
Another global MVar to issue a sequence of unique index keys?
Ian
--
Ian Stark http://www.ed.ac.uk/~stark
LFCS, School of Informatics, The University of Edinburgh, Scotland
More information about the Haskell-Cafe
mailing list