toy-lib-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.MultiSet2

Description

Multi set backed by Map.

Synopsis

Documentation

type MultiSet2 k = (Int, Map k Int) #

MultiSet2: (nKeys, (key -> count))

emptyMS2 :: MultiSet2 k #

\(O(1)\)

singletonMS2 :: k -> MultiSet2 k #

\(O(1)\)

fromListMS2 :: Ord k => [k] -> MultiSet2 k #

\(O(N W)\)

incMS2 :: Ord k => k -> MultiSet2 k -> MultiSet2 k #

\(O(W)\) Increments key.

decMS2 :: Ord k => k -> MultiSet2 k -> MultiSet2 k #

\(O(W)\) Decrements key.

addMS2 :: Ord k => k -> Int -> MultiSet2 k -> MultiSet2 k #

\(O(W)\) Adds key by dn.

subMS2 :: Ord k => k -> Int -> MultiSet2 k -> MultiSet2 k #

\(O(W)\) Subtracts key by dn.

memberMS2 :: Ord k => k -> MultiSet2 k -> Bool #

\(O(W)\)

notMemberMS2 :: Ord k => k -> MultiSet2 k -> Bool #

\(O(W)\)

decFindMinMS2 :: Ord k => MultiSet2 k -> (k, MultiSet2 k) #

\(O(W)\)

decFindMaxMS2 :: Ord k => MultiSet2 k -> (k, MultiSet2 k) #

\(O(W)\)

lookupMS2 :: Ord k => k -> MultiSet2 k -> Maybe Int #

\(O(W)\)

getMS2 :: (HasCallStack, Ord k, Show k) => k -> MultiSet2 k -> Int #

\(O(W)\) Partial alternative to lookupMS2.

innerMS2 :: MultiSet2 k -> Map k Int #

\(O(1)\) Unwraps MultiSet2 into the underlying Map.