Safe Haskell | None |
---|
VariableMap is analagous to VariableSet and provides a mutable map ordered by key whose changes can be tracked.
- data VariableMapData key elt
- newtype VariableMapUpdate key elt = VariableMapUpdate (VariableSetUpdate (key, elt))
- data VariableMap key elt
- newEmptyVariableMap :: Ord key => IO (VariableMap key elt)
- newVariableMap :: Ord key => [(key, elt)] -> IO (VariableMap key elt)
- newVariableMapFromFM :: Ord key => Map key elt -> IO (VariableMap key elt)
- updateMap :: Ord key => VariableMap key elt -> VariableMapUpdate key elt -> IO Bool
- lookupMap :: Ord key => VariableMapData key elt -> key -> Maybe elt
- lookupWithDefaultMap :: Ord key => VariableMapData key elt -> elt -> key -> elt
- mapToList :: Ord key => VariableMapData key elt -> [(key, elt)]
- mapToFM :: Ord key => VariableMapData key elt -> Map key elt
- mapToVariableSetSource :: Ord key => (key -> elt -> element) -> VariableMap key elt -> VariableSetSource element
- addToVariableMap :: Ord key => VariableMap key elt -> key -> elt -> IO Bool
- delFromVariableMap :: Ord key => VariableMap key elt -> key -> IO Bool
- variableMapToList :: Ord key => VariableMap key elt -> IO [(key, elt)]
- lookupVariableMap :: Ord key => VariableMap key elt -> key -> IO (Maybe elt)
- getVariableMapByKey :: Ord key => VariableMap key elt -> key -> SimpleSource (Maybe elt)
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.
Ord key => HasSource (VariableMap key elt) (VariableMapData key elt) (VariableMapUpdate key elt) | 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. |
newtype VariableMapUpdate key elt Source
We recycle the VariableSetUpdate type for this.
VariableMapUpdate (VariableSetUpdate (key, elt)) |
Ord key => HasSource (VariableMap key elt) (VariableMapData key elt) (VariableMapUpdate key elt) | 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. |
data VariableMap key elt Source
Typeable2 VariableMap | |
Ord key => HasSource (VariableMap key elt) (VariableMapData key elt) (VariableMapUpdate key elt) | 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. |
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 BoolSource
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 eltSource
lookupWithDefaultMap :: Ord key => VariableMapData key elt -> elt -> key -> eltSource
mapToList :: Ord key => VariableMapData key elt -> [(key, elt)]Source
mapToFM :: Ord key => VariableMapData key elt -> Map key eltSource
mapToVariableSetSource :: Ord key => (key -> elt -> element) -> VariableMap key elt -> VariableSetSource elementSource
Given a variable map and conversion function, produce a VariableSetSource
addToVariableMap :: Ord key => VariableMap key elt -> key -> elt -> IO BoolSource
delFromVariableMap :: Ord key => VariableMap key elt -> key -> IO BoolSource
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