module Util.MultiSet where
import Prelude hiding (lookup)
import qualified Data.Map.Strict as Map
type MultiSet k = Map.Map k Int
insert :: Ord k => k -> MultiSet k -> MultiSet k
insert :: forall k. Ord k => k -> MultiSet k -> MultiSet k
insert k
key = forall k a. Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a
Map.insertWith forall a. Num a => a -> a -> a
(+) k
key Int
1
lookup :: Ord k => k -> MultiSet k -> Int
lookup :: forall k. Ord k => k -> MultiSet k -> Int
lookup = forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault Int
0