@@ -157,7 +157,11 @@ newtype MonoidalIntMap a = MonoidalIntMap { getMonoidalIntMap :: M.IntMap a }
157157 deriving (Show, Read, Functor, Eq, Ord, NFData,
158158 Foldable, Traversable,
159159 FromJSON, ToJSON, FromJSON1, ToJSON1,
160− Data, Typeable, Align)
160+ Data, Typeable, Align
161+#if MIN_VERSION_these(0,8,0)
162+ , Semialign
163+#endif
164+ )
161165
162166#if MIN_VERSION_containers(0,5,9)
163167deriving instance Eq1 MonoidalIntMap
@@ -317,8 +321,8 @@ empty :: forall a. MonoidalIntMap a
317321empty = coerce (M.empty :: M.IntMap a)
318322{-# INLINE empty #-}
319323
320−insert :: forall a. Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
321−insert = coerce (M.insert :: Int -> a -> M.IntMap a -> M.IntMap a)
324+insert :: forall a. Semigroup a => Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
325+insert = coerce (M.insertWith (<>) :: Int -> a -> M.IntMap a -> M.IntMap a)
322326{-# INLINE insert #-}
323327
324328insertWith :: forall a. (a -> a -> a) -> Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
@@ -417,8 +421,8 @@ mapAccumRWithKey :: forall a b c. (a -> Int -> b -> (a, c)) -> a -> MonoidalIntM
417421mapAccumRWithKey = coerce (M.mapAccumRWithKey :: (a -> Int -> b -> (a, c)) -> a -> M.IntMap b -> (a, M.IntMap c))
418422{-# INLINE mapAccumRWithKey #-}
419423
420−mapKeys :: forall a. (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
421−mapKeys = coerce (M.mapKeys :: (Int -> Int) -> M.IntMap a -> M.IntMap a)
424+mapKeys :: forall a. Semigroup a => (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
425+mapKeys = coerce (M.mapKeysWith (<>) :: (Int -> Int) -> M.IntMap a -> M.IntMap a)
422426{-# INLINE mapKeys #-}
423427
424428mapKeysWith :: forall a. (a -> a -> a) -> (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
@@ -577,26 +581,6 @@ isProperSubmapOfBy :: forall a b. (a -> b -> Bool) -> MonoidalIntMap a -> Monoid
577581isProperSubmapOfBy = coerce (M.isProperSubmapOfBy :: (a -> b -> Bool) -> M.IntMap a -> M.IntMap b -> Bool)
578582{-# INLINE isProperSubmapOfBy #-}
579583
580−-- lookupIndex :: forall a. Ord k => k -> MonoidalIntMap a -> Maybe Int
581−-- lookupIndex = coerce (M.lookupIndex :: k -> M.IntMap a -> Maybe Int)
582−-- {-# INLINE lookupIndex #-}
583−
584−-- findIndex :: forall a. Ord k => k -> MonoidalIntMap a -> Int
585−-- findIndex = coerce (M.findIndex :: k -> M.IntMap a -> Int)
586−-- {-# INLINE findIndex #-}
587−
588−-- elemAt :: forall a. Int -> MonoidalIntMap a -> (Int, a)
589−-- elemAt = coerce (M.elemAt :: Int -> M.IntMap a -> (Int, a))
590−-- {-# INLINE elemAt #-}
591−
592−-- updateAt :: forall a. (Int -> a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
593−-- updateAt = coerce (M.updateAt :: (Int -> a -> Maybe a) -> Int -> M.IntMap a -> M.IntMap a)
594−-- {-# INLINE updateAt #-}
595−
596−-- deleteAt :: forall a. Int -> MonoidalIntMap a -> MonoidalIntMap a
597−-- deleteAt = coerce (M.deleteAt :: Int -> M.IntMap a -> M.IntMap a)
598−-- {-# INLINE deleteAt #-}
599−
600584findMin :: forall a. MonoidalIntMap a -> (Int, a)
601585findMin = coerce (M.findMin :: M.IntMap a -> (Int, a))
602586{-# INLINE findMin #-}
@@ -653,16 +637,3 @@ maxViewWithKey :: forall a. MonoidalIntMap a -> Maybe ((Int, a), MonoidalIntMap
653637maxViewWithKey = coerce (M.maxViewWithKey :: M.IntMap a -> Maybe ((Int, a), M.IntMap a))
654638{-# INLINE maxViewWithKey #-}
655639
656−-- showTree :: forall a. (Show k, Show a) => MonoidalIntMap a -> String
657−-- showTree = coerce (M.showTree :: (Show k, Show a) => M.IntMap a -> String)
658−-- {-# INLINE showTree #-}
659−
660−-- showTreeWith :: forall a. (Int -> a -> String) -> Bool -> Bool -> MonoidalIntMap a -> String
661−-- showTreeWith = coerce (M.showTreeWith :: (Int -> a -> String) -> Bool -> Bool -> M.IntMap a -> String)
662−-- {-# INLINE showTreeWith #-}
663−
664−--valid :: forall a. Ord k => MonoidalIntMap a -> Bool
665−--valid = coerce (M.valid :: Ord k => M.IntMap a -> Bool)
666−--{-# INLINE valid #-}
667−
668−