AVar-0.0.5.1: Mutable variables with Exception handling and concurrency support.

Data.AVar.Internal

Contents

Description

The guts of how AVars work.

Synopsis

Types

data AVar a Source

AVars 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.

Constructors

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.

Constructors

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

functions on AVars

newAVar :: a -> IO (AVar a)Source

newAVar creates a new variable. It forks off the handler that does the work for the variable itself and creates a new AVar.