The guts of how AVars work.
- data AVar a = AVar (Chan (Transaction a))
- data Transaction a
- newAVar :: a -> IO (AVar a)
Types
AVar
s are the means through which communication with the variable are
conducted. They contain a Chan that is connected
to the variable, and
is read by the variable's handler
function.
AVar (Chan (Transaction a)) |
data Transaction a Source
A Transaction
describes what should happen to a variable.
They are only used internally, and are here just for reference.
Put a | puts the a into the variable |
Get (MVar a) | reads the variable |
Mod (a -> a) (MVar (Maybe SomeException)) | modifies the variable |
JustMod (a -> a) | Just modifies the variable (unless an exception occurs) |
forall b . Mod' (a -> (a, b)) (MVar (Either SomeException b)) | modifies the variable, returning the b result to the caller |
Atom (a -> Bool) (a -> a) (a -> a) (MVar (Either SomeException Bool)) | conditionally modifies a variable |