git.iko.soy/monoidal-containers
on master help sign in
add most Data.Map.Strict functions
commit7514c4e701c5fc9e608221096763c7db28c319a3 authordbornside <dan.bornside@obsidian.systems> dateWed 15 Aug 2018, 14:34 (8 years ago) parent38b2aca
1 file changed+489−5
src/Data/Map/Monoidal/Strict.hs+489−5
src/Data/Map/Monoidal/Strict.hs+489−5
@@ -5,6 +5,7 @@
55{-# LANGUAGE GeneralizedNewtypeDeriving #-}
66{-# LANGUAGE DeriveTraversable #-}
77{-# LANGUAGE DeriveDataTypeable #-}
8+{-# LANGUAGE ScopedTypeVariables #-}
89
910-- | This module provides a 'Data.Map' variant which uses the value's
1011-- 'Monoid' instance to accumulate conflicting entries when merging
@@ -26,17 +27,117 @@ module Data.Map.Monoidal.Strict
2627 , assocs
2728 , elems
2829 , keys
30+ , (!)
31+ , (\\)
32+ , adjust
33+ , adjustWithKey
34+ , alter
35+ , delete
36+ , deleteAt
37+ , deleteFindMax
38+ , deleteFindMin
39+ , deleteMax
40+ , deleteMin
41+ , difference
42+ , differenceWith
43+ , differenceWithKey
44+ , elemAt
45+ , empty
46+ , filter
47+ , filterWithKey
48+ , findIndex
49+ , findMax
50+ , findMin
51+ , foldMapWithKey
52+ , foldl
53+ , foldl'
54+ , foldlWithKey
55+ , foldlWithKey'
56+ , foldr
57+ , foldr'
58+ , foldrWithKey
59+ , foldrWithKey'
60+ , fromAscList
61+ , fromAscListWith
62+ , fromAscListWithKey
63+ , fromDistinctAscList
64+ , fromList
65+ , fromListWith
66+ , fromListWithKey
67+ , fromSet
68+ , insert
69+ , insertLookupWithKey
70+ , insertWith
71+ , insertWithKey
72+ , intersectionWith
73+ , intersectionWithKey
74+ , isProperSubmapOf
75+ , isProperSubmapOfBy
76+ , isSubmapOf
77+ , isSubmapOfBy
78+ , keysSet
79+ , lookup
80+ , lookupGE
81+ , lookupGT
82+ , lookupIndex
83+ , lookupLE
84+ , lookupLT
85+ , map
86+ , mapAccum
87+ , mapAccumRWithKey
88+ , mapAccumWithKey
89+ , mapEither
90+ , mapEitherWithKey
91+ , mapKeys
92+ , mapKeysMonotonic
93+ , mapKeysWith
94+ , mapMaybe
95+ , mapMaybeWithKey
96+ , mapWithKey
97+ , maxView
98+ , maxViewWithKey
99+ , mergeWithKey
100+ , minView
101+ , minViewWithKey
102+ , null
103+ , partition
104+ , partitionWithKey
105+ , split
106+ , splitLookup
107+ , splitRoot
108+ , toAscList
109+ , toDescList
110+ , toList
111+ , traverseWithKey
112+ , unionWith
113+ , unionWithKey
114+ , unionsWith
115+ , update
116+ , updateAt
117+ , updateLookupWithKey
118+ , updateMax
119+ , updateMaxWithKey
120+ , updateMin
121+ , updateMinWithKey
122+ , updateWithKey
123+ , valid
124+ -- , showTree
125+ -- , showTreeWith
29126 ) where
30127
128+import Prelude hiding (null, lookup, map, foldl, foldr, filter)
129+
130+import Data.Coerce (coerce)
31131import Data.Semigroup
32132import Data.Foldable (Foldable)
33133import Data.Traversable (Traversable)
34134import Control.Applicative (Applicative, pure)
35135import Data.Data (Data)
36136import Data.Typeable (Typeable)
137+import Data.Set (Set)
37138
38139#if MIN_VERSION_base(4,7,0)
39−import GHC.Exts (IsList(..))
140+import qualified GHC.Exts as IsList
40141#endif
41142
42143import Control.DeepSeq
@@ -67,9 +168,9 @@ instance Ord k => At (MonoidalMap k a) where
67168
68169instance Each (MonoidalMap k a) (MonoidalMap k b) a b
69170
70−instance Ord k => FunctorWithIndex k (MonoidalMap k)
71−instance Ord k => FoldableWithIndex k (MonoidalMap k)
72−instance Ord k => TraversableWithIndex k (MonoidalMap k) where
171+instance FunctorWithIndex k (MonoidalMap k)
172+instance FoldableWithIndex k (MonoidalMap k)
173+instance TraversableWithIndex k (MonoidalMap k) where
73174 itraverse f (MonoidalMap m) = fmap MonoidalMap $ itraverse f m
74175 {-# INLINE itraverse #-}
75176
@@ -108,7 +209,7 @@ instance Newtype (MonoidalMap k a) (M.Map k a) where
108209 {-# INLINE unpack #-}
109210
110211#if MIN_VERSION_base(4,7,0)
111−instance (Ord k, Semigroup a) => IsList (MonoidalMap k a) where
212+instance (Ord k, Semigroup a) => IsList.IsList (MonoidalMap k a) where
112213 type Item (MonoidalMap k a) = (k, a)
113214 fromList = MonoidalMap . M.fromListWith (<>)
114215 {-# INLINE fromList #-}
@@ -165,3 +266,386 @@ elems = M.elems . unpack
165266keys :: MonoidalMap k a -> [k]
166267keys = M.keys . unpack
167268{-# INLINE keys #-}
269+
270+
271+(!) :: forall k a. Ord k => MonoidalMap k a -> k -> a
272+(!) = coerce ((M.!) :: M.Map k a -> k -> a)
273+infixl 9 !
274+
275+(\\) :: forall k a b. Ord k => MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
276+(\\) = coerce ((M.\\) :: M.Map k a -> M.Map k b -> M.Map k a)
277+infixl 9 \\ --
278+
279+null :: forall k a. MonoidalMap k a -> Bool
280+null = coerce (M.null :: M.Map k a -> Bool)
281+{-# INLINE null #-}
282+
283+lookup :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe a
284+lookup = coerce (M.lookup :: k -> M.Map k a -> Maybe a)
285+{-# INLINE lookup #-}
286+
287+lookupLT :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
288+lookupLT = coerce (M.lookupLT :: k -> M.Map k a -> Maybe (k,a))
289+{-# INLINE lookupLT #-}
290+
291+lookupGT :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
292+lookupGT = coerce (M.lookupGT :: k -> M.Map k a -> Maybe (k,a))
293+{-# INLINE lookupGT #-}
294+
295+lookupLE :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
296+lookupLE = coerce (M.lookupLE :: k -> M.Map k a -> Maybe (k,a))
297+{-# INLINE lookupLE #-}
298+
299+lookupGE :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
300+lookupGE = coerce (M.lookupGE :: k -> M.Map k a -> Maybe (k,a))
301+{-# INLINE lookupGE #-}
302+
303+empty :: forall k a. MonoidalMap k a
304+empty = coerce (M.empty :: M.Map k a)
305+{-# INLINE empty #-}
306+
307+insert :: forall k a. Ord k => k -> a -> MonoidalMap k a -> MonoidalMap k a
308+insert = coerce (M.insert :: k -> a -> M.Map k a -> M.Map k a)
309+{-# INLINE insert #-}
310+
311+insertWith :: forall k a. Ord k => (a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
312+insertWith = coerce (M.insertWith :: (a -> a -> a) -> k -> a -> M.Map k a -> M.Map k a)
313+{-# INLINE insertWith #-}
314+
315+insertWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
316+insertWithKey = coerce (M.insertWithKey :: (k -> a -> a -> a) -> k -> a -> M.Map k a -> M.Map k a)
317+{-# INLINE insertWithKey #-}
318+
319+insertLookupWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> (Maybe a, MonoidalMap k a)
320+insertLookupWithKey = coerce (M.insertLookupWithKey :: (k -> a -> a -> a) -> k -> a -> M.Map k a -> (Maybe a, M.Map k a))
321+{-# INLINE insertLookupWithKey #-}
322+
323+adjust :: forall k a. Ord k => (a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
324+adjust = coerce (M.adjust :: (a -> a) -> k -> M.Map k a -> M.Map k a)
325+{-# INLINE adjust #-}
326+
327+adjustWithKey :: forall k a. Ord k => (k -> a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
328+adjustWithKey = coerce (M.adjustWithKey :: (k -> a -> a) -> k -> M.Map k a -> M.Map k a)
329+{-# INLINE adjustWithKey #-}
330+
331+update :: forall k a. Ord k => (a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
332+update = coerce (M.update :: (a -> Maybe a) -> k -> M.Map k a -> M.Map k a)
333+{-# INLINE update #-}
334+
335+updateWithKey :: forall k a. Ord k => (k -> a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
336+updateWithKey = coerce (M.updateWithKey :: (k -> a -> Maybe a) -> k -> M.Map k a -> M.Map k a)
337+{-# INLINE updateWithKey #-}
338+
339+updateLookupWithKey :: forall k a. Ord k => (k -> a -> Maybe a) -> k -> MonoidalMap k a -> (Maybe a, MonoidalMap k a)
340+updateLookupWithKey = coerce (M.updateLookupWithKey :: (k -> a -> Maybe a) -> k -> M.Map k a -> (Maybe a, M.Map k a))
341+{-# INLINE updateLookupWithKey #-}
342+
343+alter :: forall k a. Ord k => (Maybe a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
344+alter = coerce (M.alter :: (Maybe a -> Maybe a) -> k -> M.Map k a -> M.Map k a)
345+{-# INLINE alter #-}
346+
347+unionWith :: forall k a. Ord k => (a -> a -> a) -> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
348+unionWith = coerce (M.unionWith :: (a -> a -> a) -> M.Map k a -> M.Map k a -> M.Map k a)
349+{-# INLINE unionWith #-}
350+
351+unionWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
352+unionWithKey = coerce (M.unionWithKey :: (k -> a -> a -> a) -> M.Map k a -> M.Map k a -> M.Map k a)
353+{-# INLINE unionWithKey #-}
354+
355+unionsWith :: forall k a. Ord k => (a -> a -> a) -> [MonoidalMap k a] -> MonoidalMap k a
356+unionsWith = coerce (M.unionsWith :: (a -> a -> a) -> [M.Map k a] -> M.Map k a)
357+{-# INLINE unionsWith #-}
358+
359+difference :: forall k a b. Ord k => MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
360+difference = (\\)
361+{-# INLINE difference #-}
362+
363+differenceWith :: forall k a b. Ord k => (a -> b -> Maybe a) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
364+differenceWith = coerce (M.differenceWith :: (a -> b -> Maybe a) -> M.Map k a -> M.Map k b -> M.Map k a)
365+{-# INLINE differenceWith #-}
366+
367+differenceWithKey :: forall k a b. Ord k => (k -> a -> b -> Maybe a) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
368+differenceWithKey = coerce (M.differenceWithKey :: (k -> a -> b -> Maybe a) -> M.Map k a -> M.Map k b -> M.Map k a)
369+{-# INLINE differenceWithKey #-}
370+
371+intersectionWith :: forall k a b c. Ord k => (a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
372+intersectionWith = coerce (M.intersectionWith :: (a -> b -> c) -> M.Map k a -> M.Map k b -> M.Map k c)
373+{-# INLINE intersectionWith #-}
374+
375+intersectionWithKey :: forall k a b c. Ord k => (k -> a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
376+intersectionWithKey = coerce (M.intersectionWithKey :: (k -> a -> b -> c) -> M.Map k a -> M.Map k b -> M.Map k c)
377+{-# INLINE intersectionWithKey #-}
378+
379+mergeWithKey :: forall k a b c. Ord k => (k -> a -> b -> Maybe c) -> (MonoidalMap k a -> MonoidalMap k c) -> (MonoidalMap k b -> MonoidalMap k c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
380+mergeWithKey = coerce (M.mergeWithKey :: (k -> a -> b -> Maybe c) -> (M.Map k a -> M.Map k c) -> (M.Map k b -> M.Map k c) -> M.Map k a -> M.Map k b -> M.Map k c)
381+{-# INLINE mergeWithKey #-}
382+
383+map :: (a -> b) -> MonoidalMap k a -> MonoidalMap k b
384+map = fmap
385+{-# INLINE map #-}
386+
387+mapWithKey :: forall k a b. (k -> a -> b) -> MonoidalMap k a -> MonoidalMap k b
388+mapWithKey = coerce (M.mapWithKey :: (k -> a -> b) -> M.Map k a -> M.Map k b)
389+{-# INLINE mapWithKey #-}
390+
391+traverseWithKey :: Applicative t => (k -> a -> t b) -> MonoidalMap k a -> t (MonoidalMap k b)
392+traverseWithKey = itraverse
393+{-# INLINE traverseWithKey #-}
394+
395+mapAccum :: forall k a b c. (a -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
396+mapAccum = coerce (M.mapAccum :: (a -> b -> (a, c)) -> a -> M.Map k b -> (a, M.Map k c))
397+{-# INLINE mapAccum #-}
398+
399+mapAccumWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
400+mapAccumWithKey = coerce (M.mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> M.Map k b -> (a, M.Map k c))
401+{-# INLINE mapAccumWithKey #-}
402+
403+mapAccumRWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
404+mapAccumRWithKey = coerce (M.mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> M.Map k b -> (a, M.Map k c))
405+{-# INLINE mapAccumRWithKey #-}
406+
407+mapKeys :: forall k1 k2 a. Ord k2 => (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
408+mapKeys = coerce (M.mapKeys :: (k1 -> k2) -> M.Map k1 a -> M.Map k2 a)
409+{-# INLINE mapKeys #-}
410+
411+mapKeysWith :: forall k1 k2 a. Ord k2 => (a -> a -> a) -> (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
412+mapKeysWith = coerce (M.mapKeysWith :: (a -> a -> a) -> (k1 -> k2) -> M.Map k1 a -> M.Map k2 a)
413+{-# INLINE mapKeysWith #-}
414+
415+mapKeysMonotonic :: forall k1 k2 a. (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
416+mapKeysMonotonic = coerce (M.mapKeysMonotonic :: (k1 -> k2) -> M.Map k1 a -> M.Map k2 a)
417+{-# INLINE mapKeysMonotonic #-}
418+
419+foldr :: forall k a b. (a -> b -> b) -> b -> MonoidalMap k a -> b
420+foldr = coerce (M.foldr :: (a -> b -> b) -> b -> M.Map k a -> b)
421+{-# INLINE foldr #-}
422+
423+foldl :: forall k a b. (a -> b -> a) -> a -> MonoidalMap k b -> a
424+foldl = coerce (M.foldl :: (a -> b -> a) -> a -> M.Map k b -> a)
425+{-# INLINE foldl #-}
426+
427+foldrWithKey :: forall k a b. (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
428+foldrWithKey = coerce (M.foldrWithKey :: (k -> a -> b -> b) -> b -> M.Map k a -> b)
429+{-# INLINE foldrWithKey #-}
430+
431+foldlWithKey :: forall k a b. (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
432+foldlWithKey = coerce (M.foldlWithKey :: (a -> k -> b -> a) -> a -> M.Map k b -> a)
433+{-# INLINE foldlWithKey #-}
434+
435+foldMapWithKey :: forall k a m. Monoid m => (k -> a -> m) -> MonoidalMap k a -> m
436+foldMapWithKey = coerce (M.foldMapWithKey :: Monoid m => (k -> a -> m) -> M.Map k a -> m)
437+{-# INLINE foldMapWithKey #-}
438+
439+foldr' :: forall k a b. (a -> b -> b) -> b -> MonoidalMap k a -> b
440+foldr' = coerce (M.foldr' :: (a -> b -> b) -> b -> M.Map k a -> b)
441+{-# INLINE foldr' #-}
442+
443+foldl' :: forall k a b. (a -> b -> a) -> a -> MonoidalMap k b -> a
444+foldl' = coerce (M.foldl' :: (a -> b -> a) -> a -> M.Map k b -> a)
445+{-# INLINE foldl' #-}
446+
447+foldrWithKey' :: forall k a b. (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
448+foldrWithKey' = coerce (M.foldrWithKey' :: (k -> a -> b -> b) -> b -> M.Map k a -> b)
449+{-# INLINE foldrWithKey' #-}
450+
451+foldlWithKey' :: forall k a b. (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
452+foldlWithKey' = coerce (M.foldlWithKey' :: (a -> k -> b -> a) -> a -> M.Map k b -> a)
453+{-# INLINE foldlWithKey' #-}
454+
455+keysSet :: forall k a. MonoidalMap k a -> Set k
456+keysSet = coerce (M.keysSet :: M.Map k a -> Set k)
457+{-# INLINE keysSet #-}
458+
459+fromSet :: forall k a. (k -> a) -> Set k -> MonoidalMap k a
460+fromSet = coerce (M.fromSet :: (k -> a) -> Set k -> M.Map k a)
461+{-# INLINE fromSet #-}
462+
463+toList :: forall k a. MonoidalMap k a -> [(k, a)]
464+toList = coerce (M.toList :: M.Map k a -> [(k, a)])
465+{-# INLINE toList #-}
466+
467+fromList :: forall k a. Ord k => [(k, a)] -> MonoidalMap k a
468+fromList = coerce (M.fromList :: [(k, a)] -> M.Map k a)
469+{-# INLINE fromList #-}
470+
471+fromListWith :: forall k a. Ord k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
472+fromListWith = coerce (M.fromListWith :: (a -> a -> a) -> [(k, a)] -> M.Map k a)
473+{-# INLINE fromListWith #-}
474+
475+fromListWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
476+fromListWithKey = coerce (M.fromListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> M.Map k a)
477+{-# INLINE fromListWithKey #-}
478+
479+toAscList :: forall k a. MonoidalMap k a -> [(k, a)]
480+toAscList = coerce (M.toAscList :: M.Map k a -> [(k, a)])
481+{-# INLINE toAscList #-}
482+
483+toDescList :: forall k a. MonoidalMap k a -> [(k, a)]
484+toDescList = coerce (M.toDescList :: M.Map k a -> [(k, a)])
485+{-# INLINE toDescList #-}
486+
487+fromAscList :: forall k a. Eq k => [(k, a)] -> MonoidalMap k a
488+fromAscList = coerce (M.fromAscList :: [(k, a)] -> M.Map k a)
489+{-# INLINE fromAscList #-}
490+
491+fromAscListWith :: forall k a. Eq k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
492+fromAscListWith = coerce (M.fromAscListWith :: (a -> a -> a) -> [(k, a)] -> M.Map k a)
493+{-# INLINE fromAscListWith #-}
494+
495+fromAscListWithKey :: forall k a. Eq k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
496+fromAscListWithKey = coerce (M.fromAscListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> M.Map k a)
497+{-# INLINE fromAscListWithKey #-}
498+
499+fromDistinctAscList :: forall k a. [(k, a)] -> MonoidalMap k a
500+fromDistinctAscList = coerce (M.fromDistinctAscList :: [(k, a)] -> M.Map k a)
501+{-# INLINE fromDistinctAscList #-}
502+
503+filter :: forall k a. (a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
504+filter = coerce (M.filter :: (a -> Bool) -> M.Map k a -> M.Map k a)
505+{-# INLINE filter #-}
506+
507+filterWithKey :: forall k a. (k -> a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
508+filterWithKey = coerce (M.filterWithKey :: (k -> a -> Bool) -> M.Map k a -> M.Map k a)
509+{-# INLINE filterWithKey #-}
510+
511+partition :: forall k a. (a -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
512+partition = coerce (M.partition :: (a -> Bool) -> M.Map k a -> (M.Map k a, M.Map k a))
513+{-# INLINE partition #-}
514+
515+partitionWithKey :: forall k a. (k -> a -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
516+partitionWithKey = coerce (M.partitionWithKey :: (k -> a -> Bool) -> M.Map k a -> (M.Map k a, M.Map k a))
517+{-# INLINE partitionWithKey #-}
518+
519+mapMaybe :: forall k a b. (a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
520+mapMaybe = coerce (M.mapMaybe :: (a -> Maybe b) -> M.Map k a -> M.Map k b)
521+{-# INLINE mapMaybe #-}
522+
523+mapMaybeWithKey :: forall k a b. (k -> a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
524+mapMaybeWithKey = coerce (M.mapMaybeWithKey :: (k -> a -> Maybe b) -> M.Map k a -> M.Map k b)
525+{-# INLINE mapMaybeWithKey #-}
526+
527+mapEither :: forall k a b c. (a -> Either b c) -> MonoidalMap k a -> (MonoidalMap k b, MonoidalMap k c)
528+mapEither = coerce (M.mapEither :: (a -> Either b c) -> M.Map k a -> (M.Map k b, M.Map k c))
529+{-# INLINE mapEither #-}
530+
531+mapEitherWithKey :: forall k a b c. (k -> a -> Either b c) -> MonoidalMap k a -> (MonoidalMap k b, MonoidalMap k c)
532+mapEitherWithKey = coerce (M.mapEitherWithKey :: (k -> a -> Either b c) -> M.Map k a -> (M.Map k b, M.Map k c))
533+{-# INLINE mapEitherWithKey #-}
534+
535+split :: forall k a. Ord k => k -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
536+split = coerce (M.split :: k -> M.Map k a -> (M.Map k a, M.Map k a))
537+{-# INLINE split #-}
538+
539+splitLookup :: forall k a. Ord k => k -> MonoidalMap k a -> (MonoidalMap k a, Maybe a, MonoidalMap k a)
540+splitLookup = coerce (M.splitLookup :: k -> M.Map k a -> (M.Map k a, Maybe a, M.Map k a))
541+{-# INLINE splitLookup #-}
542+
543+splitRoot :: forall k a. MonoidalMap k a -> [MonoidalMap k a]
544+splitRoot = coerce (M.splitRoot :: M.Map k a -> [M.Map k a])
545+{-# INLINE splitRoot #-}
546+
547+isSubmapOf :: forall k a. (Ord k, Eq a) => MonoidalMap k a -> MonoidalMap k a -> Bool
548+isSubmapOf = coerce (M.isSubmapOf :: M.Map k a -> M.Map k a -> Bool)
549+{-# INLINE isSubmapOf #-}
550+
551+isSubmapOfBy :: forall k a b. Ord k => (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
552+isSubmapOfBy = coerce (M.isSubmapOfBy :: (a -> b -> Bool) -> M.Map k a -> M.Map k b -> Bool)
553+{-# INLINE isSubmapOfBy #-}
554+
555+isProperSubmapOf :: forall k a. (Ord k, Eq a) => MonoidalMap k a -> MonoidalMap k a -> Bool
556+isProperSubmapOf = coerce (M.isProperSubmapOf :: M.Map k a -> M.Map k a -> Bool)
557+{-# INLINE isProperSubmapOf #-}
558+
559+isProperSubmapOfBy :: forall k a b. Ord k => (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
560+isProperSubmapOfBy = coerce (M.isProperSubmapOfBy :: (a -> b -> Bool) -> M.Map k a -> M.Map k b -> Bool)
561+{-# INLINE isProperSubmapOfBy #-}
562+
563+lookupIndex :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe Int
564+lookupIndex = coerce (M.lookupIndex :: k -> M.Map k a -> Maybe Int)
565+{-# INLINE lookupIndex #-}
566+
567+findIndex :: forall k a. Ord k => k -> MonoidalMap k a -> Int
568+findIndex = coerce (M.findIndex :: k -> M.Map k a -> Int)
569+{-# INLINE findIndex #-}
570+
571+elemAt :: forall k a. Int -> MonoidalMap k a -> (k, a)
572+elemAt = coerce (M.elemAt :: Int -> M.Map k a -> (k, a))
573+{-# INLINE elemAt #-}
574+
575+updateAt :: forall k a. (k -> a -> Maybe a) -> Int -> MonoidalMap k a -> MonoidalMap k a
576+updateAt = coerce (M.updateAt :: (k -> a -> Maybe a) -> Int -> M.Map k a -> M.Map k a)
577+{-# INLINE updateAt #-}
578+
579+deleteAt :: forall k a. Int -> MonoidalMap k a -> MonoidalMap k a
580+deleteAt = coerce (M.deleteAt :: Int -> M.Map k a -> M.Map k a)
581+{-# INLINE deleteAt #-}
582+
583+findMin :: forall k a. MonoidalMap k a -> (k, a)
584+findMin = coerce (M.findMin :: M.Map k a -> (k, a))
585+{-# INLINE findMin #-}
586+
587+findMax :: forall k a. MonoidalMap k a -> (k, a)
588+findMax = coerce (M.findMax :: M.Map k a -> (k, a))
589+{-# INLINE findMax #-}
590+
591+deleteMin :: forall k a. MonoidalMap k a -> MonoidalMap k a
592+deleteMin = coerce (M.deleteMin :: M.Map k a -> M.Map k a)
593+{-# INLINE deleteMin #-}
594+
595+deleteMax :: forall k a. MonoidalMap k a -> MonoidalMap k a
596+deleteMax = coerce (M.deleteMax :: M.Map k a -> M.Map k a)
597+{-# INLINE deleteMax #-}
598+
599+deleteFindMin :: forall k a. MonoidalMap k a -> ((k, a), MonoidalMap k a)
600+deleteFindMin = coerce (M.deleteFindMin :: M.Map k a -> ((k, a), M.Map k a))
601+{-# INLINE deleteFindMin #-}
602+
603+deleteFindMax :: forall k a. MonoidalMap k a -> ((k, a), MonoidalMap k a)
604+deleteFindMax = coerce (M.deleteFindMax :: M.Map k a -> ((k, a), M.Map k a))
605+{-# INLINE deleteFindMax #-}
606+
607+updateMin :: forall k a. (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
608+updateMin = coerce (M.updateMin :: (a -> Maybe a) -> M.Map k a -> M.Map k a)
609+{-# INLINE updateMin #-}
610+
611+updateMax :: forall k a. (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
612+updateMax = coerce (M.updateMax :: (a -> Maybe a) -> M.Map k a -> M.Map k a)
613+{-# INLINE updateMax #-}
614+
615+updateMinWithKey :: forall k a. (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
616+updateMinWithKey = coerce (M.updateMinWithKey :: (k -> a -> Maybe a) -> M.Map k a -> M.Map k a)
617+{-# INLINE updateMinWithKey #-}
618+
619+updateMaxWithKey :: forall k a. (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
620+updateMaxWithKey = coerce (M.updateMaxWithKey :: (k -> a -> Maybe a) -> M.Map k a -> M.Map k a)
621+{-# INLINE updateMaxWithKey #-}
622+
623+minView :: forall k a. MonoidalMap k a -> Maybe (a, MonoidalMap k a)
624+minView = coerce (M.minView :: M.Map k a -> Maybe (a, M.Map k a))
625+{-# INLINE minView #-}
626+
627+maxView :: forall k a. MonoidalMap k a -> Maybe (a, MonoidalMap k a)
628+maxView = coerce (M.maxView :: M.Map k a -> Maybe (a, M.Map k a))
629+{-# INLINE maxView #-}
630+
631+minViewWithKey :: forall k a. MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
632+minViewWithKey = coerce (M.minViewWithKey :: M.Map k a -> Maybe ((k, a), M.Map k a))
633+{-# INLINE minViewWithKey #-}
634+
635+maxViewWithKey :: forall k a. MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
636+maxViewWithKey = coerce (M.maxViewWithKey :: M.Map k a -> Maybe ((k, a), M.Map k a))
637+{-# INLINE maxViewWithKey #-}
638+
639+-- showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String
640+-- showTree = coerce (M.showTree :: (Show k, Show a) => M.Map k a -> String)
641+-- {-# INLINE showTree #-}
642+
643+-- showTreeWith :: forall k a. (k -> a -> String) -> Bool -> Bool -> MonoidalMap k a -> String
644+-- showTreeWith = coerce (M.showTreeWith :: (k -> a -> String) -> Bool -> Bool -> M.Map k a -> String)
645+-- {-# INLINE showTreeWith #-}
646+
647+valid :: forall k a. Ord k => MonoidalMap k a -> Bool
648+valid = coerce (M.valid :: Ord k => M.Map k a -> Bool)
649+{-# INLINE valid #-}
650+
651+