Safe Haskell | Safe-Infered |
---|
Module abstracting the peer map implementation.
This is abstracted separately since the speed of peermap updates can be a significant part of the total runtime, and as such changing the implementation should be easy in case it's needed.
- type Key = Ndx
- type Elem = Int
- type PeerMap = [(Key, Elem)]
- empty :: PeerMap
- pmCompare :: (Key, Elem) -> (Key, Elem) -> Ordering
- addWith :: (Elem -> Elem -> Elem) -> Key -> Elem -> PeerMap -> PeerMap
- accumArray :: (Elem -> Elem -> Elem) -> [(Key, Elem)] -> PeerMap
- find :: Key -> PeerMap -> Elem
- add :: Key -> Elem -> PeerMap -> PeerMap
- remove :: Key -> PeerMap -> PeerMap
- maxElem :: PeerMap -> Elem
- sumElems :: PeerMap -> Elem
Type definitions
Initialization functions
:: (Elem -> Elem -> Elem) | function used to merge the elements |
-> [(Key, Elem)] | source data |
-> PeerMap | results |
Create a PeerMap from an association list, with possible duplicates.
Basic operations
add :: Key -> Elem -> PeerMap -> PeerMapSource
Add an element to a peermap, overwriting the previous value.