Safe Haskell | None |
---|---|
Language | Haskell2010 |
VariableMap is analagous to VariableSet and provides a mutable map ordered by key whose changes can be tracked.
Synopsis
- 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.
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. |
Defined in Util.VariableMap toSource :: VariableMap key elt -> Source (VariableMapData key elt) (VariableMapUpdate key elt) Source # |
newtype VariableMapUpdate key elt Source #
We recycle the VariableSetUpdate type for this.
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. |
Defined in Util.VariableMap 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. |
Defined in Util.VariableMap 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).
lookupWithDefaultMap :: Ord key => VariableMapData key elt -> elt -> key -> elt Source #
mapToList :: Ord key => VariableMapData key elt -> [(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 #