lvish-2.0: Parallel scheduler, LVar data structures, and infrastructure to build more.

Safe HaskellUnsafe

Data.LVar.PureMap.Unsafe

Contents

Synopsis

Unsafe operations:

unsafePeekKey :: Ord k => k -> IMap k s v -> Par e s (Maybe v)

An unsafe, nonblocking version of getKey. This reveals whether

These are here only to reexport downstream:

newtype IMap k s v

The map datatype itself. Like all other LVars, it has an s parameter (think STRef) in addition to the a parameter that describes the type of elements in the set.

Performance note: There is only one mutable location in this implementation. Thus it is not a scalable implementation.

Constructors

IMap (LVar s (IORef (Map k v)) (k, v)) 

Instances

LVarData1 (IMap k)

An IMap can be treated as a generic container LVar. However, the polymorphic operations are less useful than the monomorphic ones exposed by this module.

OrderedLVarData1 (IMap k)

The IMaps in this module also have the special property that they support an O(1) freeze operation which immediately yields a Foldable container (snapFreeze).

Foldable (IMap k Trvrsbl) 
Foldable (IMap k Frzn) 
Eq (IMap k s v)

Equality is physical equality, as with IORefs.

(Show k, Show a) => Show (IMap k Trvrsbl a)

For convenience only; the user could define this.

(Show k, Show a) => Show (IMap k Frzn a) 
Generator (IMap k Frzn a) 
DeepFrz a => DeepFrz (IMap k s a) 

forEachHP

Arguments

:: Maybe HandlerPool

optional pool to enroll in

-> IMap k s v

Map to listen to

-> (k -> v -> Par e s ())

callback

-> Par e s () 

Add an (asynchronous) callback that listens for all new key/value pairs added to the map, optionally enrolled in a handler pool.