uni-util-2.3.0.2: Utilities for the uniform workbench

Safe HaskellNone
LanguageHaskell98

Util.VariableMap

Description

VariableMap is analagous to VariableSet and provides a mutable map ordered by key whose changes can be tracked.

Synopsis

Documentation

data VariableMapData key elt Source #

Describes a map update. For DelUpdate, the second parameter (the one of type elt) is irrelevant and may be undefined.

Instances
Ord key => HasSource (VariableMap key elt) (VariableMapData key elt) (VariableMapUpdate key elt) Source #

Unlike VariableSet, the contents of a variable map are not returned in concrete form but as the abstract data type VariableMapData. We provide functions for querying this.

Instance details

Defined in Util.VariableMap

Methods

toSource :: VariableMap key elt -> Source (VariableMapData key elt) (VariableMapUpdate key elt) Source #

newtype VariableMapUpdate key elt Source #

We recycle the VariableSetUpdate type for this.

Constructors

VariableMapUpdate (VariableSetUpdate (key, elt)) 
Instances
Ord key => HasSource (VariableMap key elt) (VariableMapData key elt) (VariableMapUpdate key elt) Source #

Unlike VariableSet, the contents of a variable map are not returned in concrete form but as the abstract data type VariableMapData. We provide functions for querying this.

Instance details

Defined in Util.VariableMap

Methods

toSource :: VariableMap key elt -> Source (VariableMapData key elt) (VariableMapUpdate key elt) Source #

data VariableMap key elt Source #

Instances
Ord key => HasSource (VariableMap key elt) (VariableMapData key elt) (VariableMapUpdate key elt) Source #

Unlike VariableSet, the contents of a variable map are not returned in concrete form but as the abstract data type VariableMapData. We provide functions for querying this.

Instance details

Defined in Util.VariableMap

Methods

toSource :: VariableMap key elt -> Source (VariableMapData key elt) (VariableMapUpdate key elt) Source #

newEmptyVariableMap :: Ord key => IO (VariableMap key elt) Source #

Create a new empty variable map.

newVariableMap :: Ord key => [(key, elt)] -> IO (VariableMap key elt) Source #

Create a new variable map with given contents

newVariableMapFromFM :: Ord key => Map key elt -> IO (VariableMap key elt) Source #

updateMap :: Ord key => VariableMap key elt -> VariableMapUpdate key elt -> IO Bool Source #

Update a variable map in some way. Returns True if the update was sucessful (so for insertions, the object is not already there; for deletions the object is not there).

lookupMap :: Ord key => VariableMapData key elt -> key -> Maybe elt Source #

lookupWithDefaultMap :: Ord key => VariableMapData key elt -> elt -> key -> elt Source #

mapToList :: Ord key => VariableMapData key elt -> [(key, elt)] Source #

mapToFM :: Ord key => VariableMapData key elt -> Map key elt Source #

mapToVariableSetSource :: Ord key => (key -> elt -> element) -> VariableMap key elt -> VariableSetSource element Source #

Given a variable map and conversion function, produce a VariableSetSource

addToVariableMap :: Ord key => VariableMap key elt -> key -> elt -> IO Bool Source #

delFromVariableMap :: Ord key => VariableMap key elt -> key -> IO Bool Source #

variableMapToList :: Ord key => VariableMap key elt -> IO [(key, elt)] Source #

lookupVariableMap :: Ord key => VariableMap key elt -> key -> IO (Maybe elt) Source #

getVariableMapByKey :: Ord key => VariableMap key elt -> key -> SimpleSource (Maybe elt) Source #