observable-sharing-0.2.5: 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.

Note: this is generally unsound when f is a GADT!

type Name = StableName Source #

Shorthand for stable names.

empty :: Map f Source #

Construct an empty map.

singleton :: Name 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 :: Name a -> Map f -> Bool Source #

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

(!) :: Map f -> Name a -> f a Source #

Unsafe lookup

lookup :: Name a -> Map f -> Maybe (f a) Source #

Finds the value associated with the name, or Nothing if the name 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 :: forall f a. Name a -> Map f -> Map f Source #

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

adjust :: forall f a b. (f a -> f b) -> Name a -> Map f -> Map f Source #

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

filter :: (forall a. f a -> Bool) -> Map f -> Map f Source #

Filters the map for values matching the predicate

hmap :: forall f h a. (f a -> h a) -> Map f -> Map h Source #

Map over the container types

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.

data Entry f Source #

Entry in map.

Constructors

forall a. Entry (Name a) (f a) 

toList :: Map f -> [Entry f] Source #

Fetches all the elements of a map.

fromList :: [Entry f] -> Map f Source #

Constructs a map from a list of entries.