observable-sharing-0.2.0.0: Simple observable sharing

Safe HaskellNone
LanguageHaskell2010

Data.Ref.Map

Synopsis

Documentation

data Map f Source

A reference indexed map.

useful for associating info with a reference.

empty :: Map f Source

Construct an empty map.

singleton :: Ref a -> f a -> Map f Source

Construct a map with a single element.

null :: Map f -> Bool Source

Returns True if the map is empty, False otherwise.

size :: Map f -> Int Source

Returns the number of elements stored in this map.

member :: Ref a -> Map f -> Bool Source

Returns True if the reference is present in the map, False otherwise.

lookup :: Ref a -> Map f -> Maybe (f a) Source

Returns the value associated with the reference, or Nothing if the reference has no value associated to it.

insert :: Ref a -> f a -> Map f -> Map f Source

Associates a reference with the specified value. If the map already contains a mapping for the reference, the old value is replaced.

delete :: Ref a -> Map f -> Map f Source

Removes the associated value of a reference, if any is present in the map.

adjust :: (f a -> f b) -> Ref a -> Map f -> Map f Source

Updates the associated value of a reference, if any is present in the map.

union :: Map f -> Map f -> Map f Source

Union of two maps (left biased).

difference :: Map f -> Map f -> Map f Source

Difference of two maps.

intersection :: Map f -> Map f -> Map f Source

Intersectino of two maps.

map :: (f a -> f b) -> Map f -> Map f Source

Transforms a map by applying the given function to each value.

filter :: (f a -> Bool) -> Map f -> Map f Source

Filter this map by retaining only elements which values satisfy a predicate.