module Text.Pandoc.Readers.ODT.Generic.SetMap where
import qualified Data.Map as M
import qualified Data.Set as S
type SetMap k v = M.Map k (S.Set v)
empty :: SetMap k v
empty :: forall k v. SetMap k v
empty = forall k a. Map k a
M.empty
fromList :: (Ord k, Ord v) => [(k,v)] -> SetMap k v
fromList :: forall k v. (Ord k, Ord v) => [(k, v)] -> SetMap k v
fromList = forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry forall k v. (Ord k, Ord v) => k -> v -> SetMap k v -> SetMap k v
insert) forall k v. SetMap k v
empty
insert :: (Ord k, Ord v) => k -> v -> SetMap k v -> SetMap k v
insert :: forall k v. (Ord k, Ord v) => k -> v -> SetMap k v -> SetMap k v
insert k
key v
value SetMap k v
setMap = forall k a. Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a
M.insertWith forall a. Ord a => Set a -> Set a -> Set a
S.union k
key (forall a. a -> Set a
S.singleton v
value) SetMap k v
setMap
union3 :: (Ord k) => SetMap k v -> SetMap k v -> SetMap k v -> SetMap k v
union3 :: forall k v.
Ord k =>
SetMap k v -> SetMap k v -> SetMap k v -> SetMap k v
union3 SetMap k v
sm1 SetMap k v
sm2 SetMap k v
sm3 = SetMap k v
sm1 forall k a. Ord k => Map k a -> Map k a -> Map k a
`M.union` SetMap k v
sm2 forall k a. Ord k => Map k a -> Map k a -> Map k a
`M.union` SetMap k v
sm3