@@ -1,4 +1,5 @@
11{-# LANGUAGE CPP #-}
2+{-# LANGUAGE ScopedTypeVariables #-}
23{-# LANGUAGE MultiParamTypeClasses #-}
34{-# LANGUAGE TypeFamilies #-}
45{-# LANGUAGE FlexibleInstances #-}
@@ -26,8 +27,108 @@ module Data.Map.Monoidal
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)
131+import Data.Set (Set)
31132import Data.Semigroup
32133import Data.Foldable (Foldable)
33134import Data.Traversable (Traversable)
@@ -36,7 +137,7 @@ import Data.Data (Data)
36137import Data.Typeable (Typeable)
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,387 @@ elems = M.elems . unpack
165266keys :: MonoidalMap k a -> [k]
166267keys = M.keys . unpack
167268{-# INLINE keys #-}
269+
270+
271+
272+(!) :: forall k a. Ord k => MonoidalMap k a -> k -> a
273+(!) = coerce ((M.!) :: M.Map k a -> k -> a)
274+infixl 9 !
275+
276+(\\) :: forall k a b. Ord k => MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
277+(\\) = coerce ((M.\\) :: M.Map k a -> M.Map k b -> M.Map k a)
278+infixl 9 \\ --
279+
280+null :: forall k a. MonoidalMap k a -> Bool
281+null = coerce (M.null :: M.Map k a -> Bool)
282+{-# INLINE null #-}
283+
284+lookup :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe a
285+lookup = coerce (M.lookup :: k -> M.Map k a -> Maybe a)
286+{-# INLINE lookup #-}
287+
288+lookupLT :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
289+lookupLT = coerce (M.lookupLT :: k -> M.Map k a -> Maybe (k,a))
290+{-# INLINE lookupLT #-}
291+
292+lookupGT :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
293+lookupGT = coerce (M.lookupGT :: k -> M.Map k a -> Maybe (k,a))
294+{-# INLINE lookupGT #-}
295+
296+lookupLE :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
297+lookupLE = coerce (M.lookupLE :: k -> M.Map k a -> Maybe (k,a))
298+{-# INLINE lookupLE #-}
299+
300+lookupGE :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
301+lookupGE = coerce (M.lookupGE :: k -> M.Map k a -> Maybe (k,a))
302+{-# INLINE lookupGE #-}
303+
304+empty :: forall k a. MonoidalMap k a
305+empty = coerce (M.empty :: M.Map k a)
306+{-# INLINE empty #-}
307+
308+insert :: forall k a. Ord k => k -> a -> MonoidalMap k a -> MonoidalMap k a
309+insert = coerce (M.insert :: k -> a -> M.Map k a -> M.Map k a)
310+{-# INLINE insert #-}
311+
312+insertWith :: forall k a. Ord k => (a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
313+insertWith = coerce (M.insertWith :: (a -> a -> a) -> k -> a -> M.Map k a -> M.Map k a)
314+{-# INLINE insertWith #-}
315+
316+insertWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
317+insertWithKey = coerce (M.insertWithKey :: (k -> a -> a -> a) -> k -> a -> M.Map k a -> M.Map k a)
318+{-# INLINE insertWithKey #-}
319+
320+insertLookupWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> (Maybe a, MonoidalMap k a)
321+insertLookupWithKey = coerce (M.insertLookupWithKey :: (k -> a -> a -> a) -> k -> a -> M.Map k a -> (Maybe a, M.Map k a))
322+{-# INLINE insertLookupWithKey #-}
323+
324+adjust :: forall k a. Ord k => (a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
325+adjust = coerce (M.adjust :: (a -> a) -> k -> M.Map k a -> M.Map k a)
326+{-# INLINE adjust #-}
327+
328+adjustWithKey :: forall k a. Ord k => (k -> a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
329+adjustWithKey = coerce (M.adjustWithKey :: (k -> a -> a) -> k -> M.Map k a -> M.Map k a)
330+{-# INLINE adjustWithKey #-}
331+
332+update :: forall k a. Ord k => (a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
333+update = coerce (M.update :: (a -> Maybe a) -> k -> M.Map k a -> M.Map k a)
334+{-# INLINE update #-}
335+
336+updateWithKey :: forall k a. Ord k => (k -> a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
337+updateWithKey = coerce (M.updateWithKey :: (k -> a -> Maybe a) -> k -> M.Map k a -> M.Map k a)
338+{-# INLINE updateWithKey #-}
339+
340+updateLookupWithKey :: forall k a. Ord k => (k -> a -> Maybe a) -> k -> MonoidalMap k a -> (Maybe a, MonoidalMap k a)
341+updateLookupWithKey = coerce (M.updateLookupWithKey :: (k -> a -> Maybe a) -> k -> M.Map k a -> (Maybe a, M.Map k a))
342+{-# INLINE updateLookupWithKey #-}
343+
344+alter :: forall k a. Ord k => (Maybe a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
345+alter = coerce (M.alter :: (Maybe a -> Maybe a) -> k -> M.Map k a -> M.Map k a)
346+{-# INLINE alter #-}
347+
348+unionWith :: forall k a. Ord k => (a -> a -> a) -> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
349+unionWith = coerce (M.unionWith :: (a -> a -> a) -> M.Map k a -> M.Map k a -> M.Map k a)
350+{-# INLINE unionWith #-}
351+
352+unionWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
353+unionWithKey = coerce (M.unionWithKey :: (k -> a -> a -> a) -> M.Map k a -> M.Map k a -> M.Map k a)
354+{-# INLINE unionWithKey #-}
355+
356+unionsWith :: forall k a. Ord k => (a -> a -> a) -> [MonoidalMap k a] -> MonoidalMap k a
357+unionsWith = coerce (M.unionsWith :: (a -> a -> a) -> [M.Map k a] -> M.Map k a)
358+{-# INLINE unionsWith #-}
359+
360+difference :: forall k a b. Ord k => MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
361+difference = (\\)
362+{-# INLINE difference #-}
363+
364+differenceWith :: forall k a b. Ord k => (a -> b -> Maybe a) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
365+differenceWith = coerce (M.differenceWith :: (a -> b -> Maybe a) -> M.Map k a -> M.Map k b -> M.Map k a)
366+{-# INLINE differenceWith #-}
367+
368+differenceWithKey :: forall k a b. Ord k => (k -> a -> b -> Maybe a) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
369+differenceWithKey = coerce (M.differenceWithKey :: (k -> a -> b -> Maybe a) -> M.Map k a -> M.Map k b -> M.Map k a)
370+{-# INLINE differenceWithKey #-}
371+
372+intersectionWith :: forall k a b c. Ord k => (a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
373+intersectionWith = coerce (M.intersectionWith :: (a -> b -> c) -> M.Map k a -> M.Map k b -> M.Map k c)
374+{-# INLINE intersectionWith #-}
375+
376+intersectionWithKey :: forall k a b c. Ord k => (k -> a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
377+intersectionWithKey = coerce (M.intersectionWithKey :: (k -> a -> b -> c) -> M.Map k a -> M.Map k b -> M.Map k c)
378+{-# INLINE intersectionWithKey #-}
379+
380+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
381+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)
382+{-# INLINE mergeWithKey #-}
383+
384+map :: (a -> b) -> MonoidalMap k a -> MonoidalMap k b
385+map = fmap
386+{-# INLINE map #-}
387+
388+mapWithKey :: forall k a b. (k -> a -> b) -> MonoidalMap k a -> MonoidalMap k b
389+mapWithKey = coerce (M.mapWithKey :: (k -> a -> b) -> M.Map k a -> M.Map k b)
390+{-# INLINE mapWithKey #-}
391+
392+traverseWithKey :: Applicative t => (k -> a -> t b) -> MonoidalMap k a -> t (MonoidalMap k b)
393+traverseWithKey = itraverse
394+{-# INLINE traverseWithKey #-}
395+
396+mapAccum :: forall k a b c. (a -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
397+mapAccum = coerce (M.mapAccum :: (a -> b -> (a, c)) -> a -> M.Map k b -> (a, M.Map k c))
398+{-# INLINE mapAccum #-}
399+
400+mapAccumWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
401+mapAccumWithKey = coerce (M.mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> M.Map k b -> (a, M.Map k c))
402+{-# INLINE mapAccumWithKey #-}
403+
404+mapAccumRWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
405+mapAccumRWithKey = coerce (M.mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> M.Map k b -> (a, M.Map k c))
406+{-# INLINE mapAccumRWithKey #-}
407+
408+mapKeys :: forall k1 k2 a. Ord k2 => (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
409+mapKeys = coerce (M.mapKeys :: (k1 -> k2) -> M.Map k1 a -> M.Map k2 a)
410+{-# INLINE mapKeys #-}
411+
412+mapKeysWith :: forall k1 k2 a. Ord k2 => (a -> a -> a) -> (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
413+mapKeysWith = coerce (M.mapKeysWith :: (a -> a -> a) -> (k1 -> k2) -> M.Map k1 a -> M.Map k2 a)
414+{-# INLINE mapKeysWith #-}
415+
416+mapKeysMonotonic :: forall k1 k2 a. (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
417+mapKeysMonotonic = coerce (M.mapKeysMonotonic :: (k1 -> k2) -> M.Map k1 a -> M.Map k2 a)
418+{-# INLINE mapKeysMonotonic #-}
419+
420+foldr :: forall k a b. (a -> b -> b) -> b -> MonoidalMap k a -> b
421+foldr = coerce (M.foldr :: (a -> b -> b) -> b -> M.Map k a -> b)
422+{-# INLINE foldr #-}
423+
424+foldl :: forall k a b. (a -> b -> a) -> a -> MonoidalMap k b -> a
425+foldl = coerce (M.foldl :: (a -> b -> a) -> a -> M.Map k b -> a)
426+{-# INLINE foldl #-}
427+
428+foldrWithKey :: forall k a b. (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
429+foldrWithKey = coerce (M.foldrWithKey :: (k -> a -> b -> b) -> b -> M.Map k a -> b)
430+{-# INLINE foldrWithKey #-}
431+
432+foldlWithKey :: forall k a b. (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
433+foldlWithKey = coerce (M.foldlWithKey :: (a -> k -> b -> a) -> a -> M.Map k b -> a)
434+{-# INLINE foldlWithKey #-}
435+
436+foldMapWithKey :: forall k a m. Monoid m => (k -> a -> m) -> MonoidalMap k a -> m
437+foldMapWithKey = coerce (M.foldMapWithKey :: Monoid m => (k -> a -> m) -> M.Map k a -> m)
438+{-# INLINE foldMapWithKey #-}
439+
440+foldr' :: forall k a b. (a -> b -> b) -> b -> MonoidalMap k a -> b
441+foldr' = coerce (M.foldr' :: (a -> b -> b) -> b -> M.Map k a -> b)
442+{-# INLINE foldr' #-}
443+
444+foldl' :: forall k a b. (a -> b -> a) -> a -> MonoidalMap k b -> a
445+foldl' = coerce (M.foldl' :: (a -> b -> a) -> a -> M.Map k b -> a)
446+{-# INLINE foldl' #-}
447+
448+foldrWithKey' :: forall k a b. (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
449+foldrWithKey' = coerce (M.foldrWithKey' :: (k -> a -> b -> b) -> b -> M.Map k a -> b)
450+{-# INLINE foldrWithKey' #-}
451+
452+foldlWithKey' :: forall k a b. (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
453+foldlWithKey' = coerce (M.foldlWithKey' :: (a -> k -> b -> a) -> a -> M.Map k b -> a)
454+{-# INLINE foldlWithKey' #-}
455+
456+keysSet :: forall k a. MonoidalMap k a -> Set k
457+keysSet = coerce (M.keysSet :: M.Map k a -> Set k)
458+{-# INLINE keysSet #-}
459+
460+fromSet :: forall k a. (k -> a) -> Set k -> MonoidalMap k a
461+fromSet = coerce (M.fromSet :: (k -> a) -> Set k -> M.Map k a)
462+{-# INLINE fromSet #-}
463+
464+toList :: forall k a. MonoidalMap k a -> [(k, a)]
465+toList = coerce (M.toList :: M.Map k a -> [(k, a)])
466+{-# INLINE toList #-}
467+
468+fromList :: forall k a. Ord k => [(k, a)] -> MonoidalMap k a
469+fromList = coerce (M.fromList :: [(k, a)] -> M.Map k a)
470+{-# INLINE fromList #-}
471+
472+fromListWith :: forall k a. Ord k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
473+fromListWith = coerce (M.fromListWith :: (a -> a -> a) -> [(k, a)] -> M.Map k a)
474+{-# INLINE fromListWith #-}
475+
476+fromListWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
477+fromListWithKey = coerce (M.fromListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> M.Map k a)
478+{-# INLINE fromListWithKey #-}
479+
480+toAscList :: forall k a. MonoidalMap k a -> [(k, a)]
481+toAscList = coerce (M.toAscList :: M.Map k a -> [(k, a)])
482+{-# INLINE toAscList #-}
483+
484+toDescList :: forall k a. MonoidalMap k a -> [(k, a)]
485+toDescList = coerce (M.toDescList :: M.Map k a -> [(k, a)])
486+{-# INLINE toDescList #-}
487+
488+fromAscList :: forall k a. Eq k => [(k, a)] -> MonoidalMap k a
489+fromAscList = coerce (M.fromAscList :: [(k, a)] -> M.Map k a)
490+{-# INLINE fromAscList #-}
491+
492+fromAscListWith :: forall k a. Eq k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
493+fromAscListWith = coerce (M.fromAscListWith :: (a -> a -> a) -> [(k, a)] -> M.Map k a)
494+{-# INLINE fromAscListWith #-}
495+
496+fromAscListWithKey :: forall k a. Eq k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
497+fromAscListWithKey = coerce (M.fromAscListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> M.Map k a)
498+{-# INLINE fromAscListWithKey #-}
499+
500+fromDistinctAscList :: forall k a. [(k, a)] -> MonoidalMap k a
501+fromDistinctAscList = coerce (M.fromDistinctAscList :: [(k, a)] -> M.Map k a)
502+{-# INLINE fromDistinctAscList #-}
503+
504+filter :: forall k a. (a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
505+filter = coerce (M.filter :: (a -> Bool) -> M.Map k a -> M.Map k a)
506+{-# INLINE filter #-}
507+
508+filterWithKey :: forall k a. (k -> a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
509+filterWithKey = coerce (M.filterWithKey :: (k -> a -> Bool) -> M.Map k a -> M.Map k a)
510+{-# INLINE filterWithKey #-}
511+
512+partition :: forall k a. (a -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
513+partition = coerce (M.partition :: (a -> Bool) -> M.Map k a -> (M.Map k a, M.Map k a))
514+{-# INLINE partition #-}
515+
516+partitionWithKey :: forall k a. (k -> a -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
517+partitionWithKey = coerce (M.partitionWithKey :: (k -> a -> Bool) -> M.Map k a -> (M.Map k a, M.Map k a))
518+{-# INLINE partitionWithKey #-}
519+
520+mapMaybe :: forall k a b. (a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
521+mapMaybe = coerce (M.mapMaybe :: (a -> Maybe b) -> M.Map k a -> M.Map k b)
522+{-# INLINE mapMaybe #-}
523+
524+mapMaybeWithKey :: forall k a b. (k -> a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
525+mapMaybeWithKey = coerce (M.mapMaybeWithKey :: (k -> a -> Maybe b) -> M.Map k a -> M.Map k b)
526+{-# INLINE mapMaybeWithKey #-}
527+
528+mapEither :: forall k a b c. (a -> Either b c) -> MonoidalMap k a -> (MonoidalMap k b, MonoidalMap k c)
529+mapEither = coerce (M.mapEither :: (a -> Either b c) -> M.Map k a -> (M.Map k b, M.Map k c))
530+{-# INLINE mapEither #-}
531+
532+mapEitherWithKey :: forall k a b c. (k -> a -> Either b c) -> MonoidalMap k a -> (MonoidalMap k b, MonoidalMap k c)
533+mapEitherWithKey = coerce (M.mapEitherWithKey :: (k -> a -> Either b c) -> M.Map k a -> (M.Map k b, M.Map k c))
534+{-# INLINE mapEitherWithKey #-}
535+
536+split :: forall k a. Ord k => k -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
537+split = coerce (M.split :: k -> M.Map k a -> (M.Map k a, M.Map k a))
538+{-# INLINE split #-}
539+
540+splitLookup :: forall k a. Ord k => k -> MonoidalMap k a -> (MonoidalMap k a, Maybe a, MonoidalMap k a)
541+splitLookup = coerce (M.splitLookup :: k -> M.Map k a -> (M.Map k a, Maybe a, M.Map k a))
542+{-# INLINE splitLookup #-}
543+
544+splitRoot :: forall k a. MonoidalMap k a -> [MonoidalMap k a]
545+splitRoot = coerce (M.splitRoot :: M.Map k a -> [M.Map k a])
546+{-# INLINE splitRoot #-}
547+
548+isSubmapOf :: forall k a. (Ord k, Eq a) => MonoidalMap k a -> MonoidalMap k a -> Bool
549+isSubmapOf = coerce (M.isSubmapOf :: M.Map k a -> M.Map k a -> Bool)
550+{-# INLINE isSubmapOf #-}
551+
552+isSubmapOfBy :: forall k a b. Ord k => (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
553+isSubmapOfBy = coerce (M.isSubmapOfBy :: (a -> b -> Bool) -> M.Map k a -> M.Map k b -> Bool)
554+{-# INLINE isSubmapOfBy #-}
555+
556+isProperSubmapOf :: forall k a. (Ord k, Eq a) => MonoidalMap k a -> MonoidalMap k a -> Bool
557+isProperSubmapOf = coerce (M.isProperSubmapOf :: M.Map k a -> M.Map k a -> Bool)
558+{-# INLINE isProperSubmapOf #-}
559+
560+isProperSubmapOfBy :: forall k a b. Ord k => (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
561+isProperSubmapOfBy = coerce (M.isProperSubmapOfBy :: (a -> b -> Bool) -> M.Map k a -> M.Map k b -> Bool)
562+{-# INLINE isProperSubmapOfBy #-}
563+
564+lookupIndex :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe Int
565+lookupIndex = coerce (M.lookupIndex :: k -> M.Map k a -> Maybe Int)
566+{-# INLINE lookupIndex #-}
567+
568+findIndex :: forall k a. Ord k => k -> MonoidalMap k a -> Int
569+findIndex = coerce (M.findIndex :: k -> M.Map k a -> Int)
570+{-# INLINE findIndex #-}
571+
572+elemAt :: forall k a. Int -> MonoidalMap k a -> (k, a)
573+elemAt = coerce (M.elemAt :: Int -> M.Map k a -> (k, a))
574+{-# INLINE elemAt #-}
575+
576+updateAt :: forall k a. (k -> a -> Maybe a) -> Int -> MonoidalMap k a -> MonoidalMap k a
577+updateAt = coerce (M.updateAt :: (k -> a -> Maybe a) -> Int -> M.Map k a -> M.Map k a)
578+{-# INLINE updateAt #-}
579+
580+deleteAt :: forall k a. Int -> MonoidalMap k a -> MonoidalMap k a
581+deleteAt = coerce (M.deleteAt :: Int -> M.Map k a -> M.Map k a)
582+{-# INLINE deleteAt #-}
583+
584+findMin :: forall k a. MonoidalMap k a -> (k, a)
585+findMin = coerce (M.findMin :: M.Map k a -> (k, a))
586+{-# INLINE findMin #-}
587+
588+findMax :: forall k a. MonoidalMap k a -> (k, a)
589+findMax = coerce (M.findMax :: M.Map k a -> (k, a))
590+{-# INLINE findMax #-}
591+
592+deleteMin :: forall k a. MonoidalMap k a -> MonoidalMap k a
593+deleteMin = coerce (M.deleteMin :: M.Map k a -> M.Map k a)
594+{-# INLINE deleteMin #-}
595+
596+deleteMax :: forall k a. MonoidalMap k a -> MonoidalMap k a
597+deleteMax = coerce (M.deleteMax :: M.Map k a -> M.Map k a)
598+{-# INLINE deleteMax #-}
599+
600+deleteFindMin :: forall k a. MonoidalMap k a -> ((k, a), MonoidalMap k a)
601+deleteFindMin = coerce (M.deleteFindMin :: M.Map k a -> ((k, a), M.Map k a))
602+{-# INLINE deleteFindMin #-}
603+
604+deleteFindMax :: forall k a. MonoidalMap k a -> ((k, a), MonoidalMap k a)
605+deleteFindMax = coerce (M.deleteFindMax :: M.Map k a -> ((k, a), M.Map k a))
606+{-# INLINE deleteFindMax #-}
607+
608+updateMin :: forall k a. (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
609+updateMin = coerce (M.updateMin :: (a -> Maybe a) -> M.Map k a -> M.Map k a)
610+{-# INLINE updateMin #-}
611+
612+updateMax :: forall k a. (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
613+updateMax = coerce (M.updateMax :: (a -> Maybe a) -> M.Map k a -> M.Map k a)
614+{-# INLINE updateMax #-}
615+
616+updateMinWithKey :: forall k a. (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
617+updateMinWithKey = coerce (M.updateMinWithKey :: (k -> a -> Maybe a) -> M.Map k a -> M.Map k a)
618+{-# INLINE updateMinWithKey #-}
619+
620+updateMaxWithKey :: forall k a. (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
621+updateMaxWithKey = coerce (M.updateMaxWithKey :: (k -> a -> Maybe a) -> M.Map k a -> M.Map k a)
622+{-# INLINE updateMaxWithKey #-}
623+
624+minView :: forall k a. MonoidalMap k a -> Maybe (a, MonoidalMap k a)
625+minView = coerce (M.minView :: M.Map k a -> Maybe (a, M.Map k a))
626+{-# INLINE minView #-}
627+
628+maxView :: forall k a. MonoidalMap k a -> Maybe (a, MonoidalMap k a)
629+maxView = coerce (M.maxView :: M.Map k a -> Maybe (a, M.Map k a))
630+{-# INLINE maxView #-}
631+
632+minViewWithKey :: forall k a. MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
633+minViewWithKey = coerce (M.minViewWithKey :: M.Map k a -> Maybe ((k, a), M.Map k a))
634+{-# INLINE minViewWithKey #-}
635+
636+maxViewWithKey :: forall k a. MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
637+maxViewWithKey = coerce (M.maxViewWithKey :: M.Map k a -> Maybe ((k, a), M.Map k a))
638+{-# INLINE maxViewWithKey #-}
639+
640+-- showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String
641+-- showTree = coerce (M.showTree :: (Show k, Show a) => M.Map k a -> String)
642+-- {-# INLINE showTree #-}
643+
644+-- showTreeWith :: forall k a. (k -> a -> String) -> Bool -> Bool -> MonoidalMap k a -> String
645+-- showTreeWith = coerce (M.showTreeWith :: (k -> a -> String) -> Bool -> Bool -> M.Map k a -> String)
646+-- {-# INLINE showTreeWith #-}
647+
648+valid :: forall k a. Ord k => MonoidalMap k a -> Bool
649+valid = coerce (M.valid :: Ord k => M.Map k a -> Bool)
650+{-# INLINE valid #-}
651+
652+