tbox-0.0.0: Transactional variables with IO hooksSource codeContentsIndex
Control.Concurrent.TBox.Class
Portabilitynon-portable (requires STM)
Stabilityexperimental
MaintainerPeter Robinson <thaldyron@gmail.com>
Description
The type class TBox.
Synopsis
class TBox t a where
writeSTM :: t a -> a -> AdvSTM ()
writeIO :: t a -> a -> IO ()
readSTM :: t a -> AdvSTM (Maybe a)
readIO :: t a -> IO (Maybe a)
deleteSTM :: t a -> AdvSTM ()
deleteIO :: t a -> IO ()
isDirty :: t a -> AdvSTM Bool
setDirty :: t a -> Bool -> AdvSTM ()
Documentation
class TBox t a whereSource

An instance of TBox is a (Adv)STM variable that might contain a value of some type a. In contrast to a plain TVar, a TBox has IO hooks that are executed transparently on updates and reads. The functions of the type class shouldn't be exposed directly but should be used via the interface defined in the module TBox.Operations.

See the module TFile for a concrete instantiation.

Methods
writeSTM :: t a -> a -> AdvSTM ()Source
writeIO :: t a -> a -> IO ()Source
readSTM :: t a -> AdvSTM (Maybe a)Source
readIO :: t a -> IO (Maybe a)Source
Note: Might be executed multiple times for the same TBox in a single transaction. See unsafeRetryWith.
deleteSTM :: t a -> AdvSTM ()Source
deleteIO :: t a -> IO ()Source
isDirty :: t a -> AdvSTM BoolSource
If isDirty yields True, the readIO hook will be run on the next read.
setDirty :: t a -> Bool -> AdvSTM ()Source
show/hide Instances
Produced by Haddock version 2.4.2