Thu, 16 Dec 1999 14:09:37 +0000 (GMT), Peter Amstutz <[EMAIL PROTECTED]> pisze:
> I' trying to write a haskell program which is centered around a very
> large data structure that must be simultaneously modified by several
> threads of execution at different areas of the data structure.
> Now, unless I'm missing something really obvious, what it seems like I
> need is mutable data structures. Is there a way to get those in haskell,
> perhaps something like the "ref" container in ML?
In ghc there are IORefs and IOArrays (in the IOExts module) - like
ML's refs, but they live in the IO monad. There are also STRefs and
STArrays (in the ST and LazyST modules), which are similar, but can
be safely encapsulated in a pure function.
For threads there are MVars (in the Concurrent module), which can
be either empty or full and can be used for synchronization and
passing data between threads. There are also some other kinds of
"variables" built on top of MVars in the Concurrent module (CVars,
Chans, semaphores, SampleVars).
None of these are Haskell98.
--
__("< Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
\__/ GCS/M d- s+:-- a22 C+++>+++$ UL++>++++$ P+++ L++>++++$ E-
^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP->+ t
QRCZAK 5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-