[Haskell-cafe] ANN: tbox-0.1.0: Transactional variables and data structures with IO hooks

Peter Robinson thaldyron at gmail.com
Fri Apr 2 16:08:38 EDT 2010


This package [1] provides STM data structures with IO hooks. The basic
building blocks are instances of class TBox. Such an instance is an
STM variable that might contain a value of some type a. In contrast to
a plain 'TVar (Maybe a)', a TBox has IO hooks that are executed
transparently on writes and reads. The IO hooks of the AdvSTM monad
extend the atomicity of STM transactions to the on-commit IO actions,
which makes it particularly suitable for implementing a persistent and
thread-safe storage. Currently the only instance of class TBox is type
TFile. A TFile serializes its content to a file using Data.Binary.

New in this release is the implementation of a skip list in module
Control.Concurrent.TBox.TSkipList that provides thread-safe
persistency. A skip list is a probabilistic data structure that
provides expected run time of O(log n) for dictionary operations
(insert, lookup, filter, leq, min, delete, update) similar to a
balanced tree. The main advantage of a skip list is that it does not
need rebalancing, which could lead to high contention among
transactions. The TFile-skip list instance tries to reconstruct the
content of its elements from the TFile-directory. See module
Control.Concurrent.TFile.TSkipList for a usage example.

Feedback is highly appreciated!

[1] http://hackage.haskell.org/package/tbox


More information about the Haskell-Cafe mailing list