@@ -5,6 +5,7 @@
5{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5{-# LANGUAGE GeneralizedNewtypeDeriving #-}
6{-# LANGUAGE DeriveTraversable #-}
6{-# LANGUAGE DeriveTraversable #-}
7{-# LANGUAGE DeriveDataTypeable #-}
7{-# LANGUAGE DeriveDataTypeable #-}
8+{-# LANGUAGE ScopedTypeVariables #-}
9-- | This module provides a 'Data.Map' variant which uses the value's
10-- | This module provides a 'Data.Map' variant which uses the value's
10-- 'Monoid' instance to accumulate conflicting entries when merging
11-- 'Monoid' instance to accumulate conflicting entries when merging
@@ -26,17 +27,117 @@ module Data.Map.Monoidal.Strict
63+ , fromDistinctAscList
69+ , insertLookupWithKey
73+ , intersectionWithKey
117+ , updateLookupWithKey
128+import Prelude hiding (null, lookup, map, foldl, foldr, filter)
130+import Data.Coerce (coerce)
31import Data.Semigroup
131import Data.Semigroup
32import Data.Foldable (Foldable)
132import Data.Foldable (Foldable)
33import Data.Traversable (Traversable)
133import Data.Traversable (Traversable)
34import Control.Applicative (Applicative, pure)
134import Control.Applicative (Applicative, pure)
35import Data.Data (Data)
135import Data.Data (Data)
36import Data.Typeable (Typeable)
136import Data.Typeable (Typeable)
137+import Data.Set (Set)
38#if MIN_VERSION_base(4,7,0)
139#if MIN_VERSION_base(4,7,0)
39−import GHC.Exts (IsList(..))
140+import qualified GHC.Exts as IsList
42import Control.DeepSeq
143import Control.DeepSeq
@@ -67,9 +168,9 @@ instance Ord k => At (MonoidalMap k a) where
68instance Each (MonoidalMap k a) (MonoidalMap k b) a b
169instance Each (MonoidalMap k a) (MonoidalMap k b) a b
70−instance Ord k => FunctorWithIndex k (MonoidalMap k)
171+instance FunctorWithIndex k (MonoidalMap k)
71−instance Ord k => FoldableWithIndex k (MonoidalMap k)
172+instance FoldableWithIndex k (MonoidalMap k)
72−instance Ord k => TraversableWithIndex k (MonoidalMap k) where
173+instance TraversableWithIndex k (MonoidalMap k) where
73 itraverse f (MonoidalMap m) = fmap MonoidalMap $ itraverse f m
174 itraverse f (MonoidalMap m) = fmap MonoidalMap $ itraverse f m
74 {-# INLINE itraverse #-}
175 {-# INLINE itraverse #-}
@@ -108,7 +209,7 @@ instance Newtype (MonoidalMap k a) (M.Map k a) where
108 {-# INLINE unpack #-}
209 {-# INLINE unpack #-}
110#if MIN_VERSION_base(4,7,0)
211#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
112 type Item (MonoidalMap k a) = (k, a)
213 type Item (MonoidalMap k a) = (k, a)
113 fromList = MonoidalMap . M.fromListWith (<>)
214 fromList = MonoidalMap . M.fromListWith (<>)
114 {-# INLINE fromList #-}
215 {-# INLINE fromList #-}
@@ -165,3 +266,386 @@ elems = M.elems . unpack
165keys :: MonoidalMap k a -> [k]
266keys :: MonoidalMap k a -> [k]
166keys = M.keys . unpack
267keys = M.keys . unpack
167{-# INLINE keys #-}
268{-# INLINE keys #-}
271+(!) :: forall k a. Ord k => MonoidalMap k a -> k -> a
272+(!) = coerce ((M.!) :: M.Map k a -> k -> a)
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)
279+null :: forall k a. MonoidalMap k a -> Bool
280+null = coerce (M.null :: M.Map k a -> Bool)
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
303+empty :: forall k a. MonoidalMap k a
304+empty = coerce (M.empty :: M.Map k a)
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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)
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 #-}
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 #-}
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 #-}
359+difference :: forall k a b. Ord k => MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
361+{-# INLINE difference #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
383+map :: (a -> b) -> MonoidalMap k a -> MonoidalMap k b
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 #-}
391+traverseWithKey :: Applicative t => (k -> a -> t b) -> MonoidalMap k a -> t (MonoidalMap k b)
392+traverseWithKey = itraverse
393+{-# INLINE traverseWithKey #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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)
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)
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 #-}
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 #-}
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 #-}
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' #-}
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' #-}
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' #-}
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' #-}
455+keysSet :: forall k a. MonoidalMap k a -> Set k
456+keysSet = coerce (M.keysSet :: M.Map k a -> Set k)
457+{-# INLINE keysSet #-}
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 #-}
463+toList :: forall k a. MonoidalMap k a -> [(k, a)]
464+toList = coerce (M.toList :: M.Map k a -> [(k, a)])
465+{-# INLINE toList #-}
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 #-}
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 #-}
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 #-}
479+toAscList :: forall k a. MonoidalMap k a -> [(k, a)]
480+toAscList = coerce (M.toAscList :: M.Map k a -> [(k, a)])
481+{-# INLINE toAscList #-}
483+toDescList :: forall k a. MonoidalMap k a -> [(k, a)]
484+toDescList = coerce (M.toDescList :: M.Map k a -> [(k, a)])
485+{-# INLINE toDescList #-}
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 #-}
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 #-}
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 #-}
499+fromDistinctAscList :: forall k a. [(k, a)] -> MonoidalMap k a
500+fromDistinctAscList = coerce (M.fromDistinctAscList :: [(k, a)] -> M.Map k a)
501+{-# INLINE fromDistinctAscList #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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))
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
583+findMin :: forall k a. MonoidalMap k a -> (k, a)
584+findMin = coerce (M.findMin :: M.Map k a -> (k, a))
585+{-# INLINE findMin #-}
587+findMax :: forall k a. MonoidalMap k a -> (k, a)
588+findMax = coerce (M.findMax :: M.Map k a -> (k, a))
589+{-# INLINE findMax #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
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 #-}
647+valid :: forall k a. Ord k => MonoidalMap k a -> Bool
648+valid = coerce (M.valid :: Ord k => M.Map k a -> Bool)