{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE StandaloneDeriving #-}

-- | This module provides a 'Data.IntMap' variant which uses the value's
-- 'Monoid' instance to accumulate conflicting entries when merging
-- 'Map's.
--
-- While some functions mirroring those of 'Data.IntMap' are provided
-- here for convenience, more specialized needs will likely want to use
-- either the 'Newtype' or 'Wrapped' instances to manipulate the
-- underlying 'Map'.

module Data.IntMap.Monoidal
    ( MonoidalIntMap(..)
      -- * Often-needed functions
    , singleton
    , size
    , member
    , notMember
    , findWithDefault
    , assocs
    , elems
    , keys
    , (!)
    , (\\)
    , adjust
    , adjustWithKey
    , alter
    , delete
--    , deleteAt
    , deleteFindMax
    , deleteFindMin
    , deleteMax
    , deleteMin
    , difference
    , differenceWith
    , differenceWithKey
--    , elemAt
    , empty
    , filter
    , filterWithKey
--    , findIndex
    , findMax
    , findMin
    , foldMapWithKey
    , foldl
    , foldl'
    , foldlWithKey
    , foldlWithKey'
    , foldr
    , foldr'
    , foldrWithKey
    , foldrWithKey'
    , fromAscList
    , fromAscListWith
    , fromAscListWithKey
    , fromDistinctAscList
    , fromDistinctList
    , fromList
    , fromListWith
    , fromListWithKey
    , fromSet
    , insert
    , insertLookupWithKey
    , insertWith
    , insertWithKey
    , intersectionWith
    , intersectionWithKey
    , isProperSubmapOf
    , isProperSubmapOfBy
    , isSubmapOf
    , isSubmapOfBy
    , keysSet
    , lookup
    , lookupGE
    , lookupGT
--    , lookupIndex
    , lookupLE
    , lookupLT
    , map
    , mapAccum
    , mapAccumRWithKey
    , mapAccumWithKey
    , mapEither
    , mapEitherWithKey
    , mapKeys
    , mapKeysMonotonic
    , mapKeysWith
    , mapMaybe
    , mapMaybeWithKey
    , mapWithKey
    , maxView
    , maxViewWithKey
    , mergeWithKey
    , minView
    , minViewWithKey
    , null
    , partition
    , partitionWithKey
    , split
    , splitLookup
    , splitRoot
    , toAscList
    , toDescList
    , toList
    , traverseWithKey
    , unionWith
    , unionWithKey
    , unionsWith
    , update
--    , updateAt
    , updateLookupWithKey
    , updateMax
    , updateMaxWithKey
    , updateMin
    , updateMinWithKey
    , updateWithKey
--    , valid
    -- , showTree
    -- , showTreeWith
    ) where

import Prelude hiding (null, lookup, map, foldl, foldr, filter)

import Data.Coerce (coerce)
import Data.IntSet (IntSet)
import Data.Semigroup
import Data.Foldable (Foldable)
import Data.Traversable (Traversable)
import Control.Applicative (Applicative, pure)
import Data.Data (Data)
import Data.Typeable (Typeable)

#if MIN_VERSION_base(4,7,0)
import qualified GHC.Exts as IsList
#endif

import Control.DeepSeq
import qualified Data.IntMap as M
import Control.Lens
import Control.Newtype
import Data.Aeson(FromJSON, ToJSON, FromJSON1, ToJSON1)
import Data.Functor.Classes
import Data.Align
#ifdef MIN_VERSION_semialign
import Data.Semialign (Unalign)
#if MIN_VERSION_semialign(1,1,0)
import Data.Zip (Zip)
#endif
#endif
import qualified Witherable

-- | An 'IntMap' with monoidal accumulation
newtype MonoidalIntMap a = MonoidalIntMap { forall a. MonoidalIntMap a -> IntMap a
getMonoidalIntMap :: M.IntMap a }
    deriving (Int -> MonoidalIntMap a -> ShowS
forall a. Show a => Int -> MonoidalIntMap a -> ShowS
forall a. Show a => [MonoidalIntMap a] -> ShowS
forall a. Show a => MonoidalIntMap a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonoidalIntMap a] -> ShowS
$cshowList :: forall a. Show a => [MonoidalIntMap a] -> ShowS
show :: MonoidalIntMap a -> String
$cshow :: forall a. Show a => MonoidalIntMap a -> String
showsPrec :: Int -> MonoidalIntMap a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> MonoidalIntMap a -> ShowS
Show, ReadPrec [MonoidalIntMap a]
ReadPrec (MonoidalIntMap a)
ReadS [MonoidalIntMap a]
forall a. Read a => ReadPrec [MonoidalIntMap a]
forall a. Read a => ReadPrec (MonoidalIntMap a)
forall a. Read a => Int -> ReadS (MonoidalIntMap a)
forall a. Read a => ReadS [MonoidalIntMap a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonoidalIntMap a]
$creadListPrec :: forall a. Read a => ReadPrec [MonoidalIntMap a]
readPrec :: ReadPrec (MonoidalIntMap a)
$creadPrec :: forall a. Read a => ReadPrec (MonoidalIntMap a)
readList :: ReadS [MonoidalIntMap a]
$creadList :: forall a. Read a => ReadS [MonoidalIntMap a]
readsPrec :: Int -> ReadS (MonoidalIntMap a)
$creadsPrec :: forall a. Read a => Int -> ReadS (MonoidalIntMap a)
Read, forall a b. a -> MonoidalIntMap b -> MonoidalIntMap a
forall a b. (a -> b) -> MonoidalIntMap a -> MonoidalIntMap b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> MonoidalIntMap b -> MonoidalIntMap a
$c<$ :: forall a b. a -> MonoidalIntMap b -> MonoidalIntMap a
fmap :: forall a b. (a -> b) -> MonoidalIntMap a -> MonoidalIntMap b
$cfmap :: forall a b. (a -> b) -> MonoidalIntMap a -> MonoidalIntMap b
Functor, MonoidalIntMap a -> MonoidalIntMap a -> Bool
forall a. Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonoidalIntMap a -> MonoidalIntMap a -> Bool
$c/= :: forall a. Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
== :: MonoidalIntMap a -> MonoidalIntMap a -> Bool
$c== :: forall a. Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
Eq, MonoidalIntMap a -> MonoidalIntMap a -> Bool
MonoidalIntMap a -> MonoidalIntMap a -> Ordering
MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (MonoidalIntMap a)
forall a. Ord a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
forall a. Ord a => MonoidalIntMap a -> MonoidalIntMap a -> Ordering
forall a.
Ord a =>
MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
min :: MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
$cmin :: forall a.
Ord a =>
MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
max :: MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
$cmax :: forall a.
Ord a =>
MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
>= :: MonoidalIntMap a -> MonoidalIntMap a -> Bool
$c>= :: forall a. Ord a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
> :: MonoidalIntMap a -> MonoidalIntMap a -> Bool
$c> :: forall a. Ord a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
<= :: MonoidalIntMap a -> MonoidalIntMap a -> Bool
$c<= :: forall a. Ord a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
< :: MonoidalIntMap a -> MonoidalIntMap a -> Bool
$c< :: forall a. Ord a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
compare :: MonoidalIntMap a -> MonoidalIntMap a -> Ordering
$ccompare :: forall a. Ord a => MonoidalIntMap a -> MonoidalIntMap a -> Ordering
Ord, MonoidalIntMap a -> ()
forall a. NFData a => MonoidalIntMap a -> ()
forall a. (a -> ()) -> NFData a
rnf :: MonoidalIntMap a -> ()
$crnf :: forall a. NFData a => MonoidalIntMap a -> ()
NFData,
              forall a. Eq a => a -> MonoidalIntMap a -> Bool
forall a. Num a => MonoidalIntMap a -> a
forall a. Ord a => MonoidalIntMap a -> a
forall m. Monoid m => MonoidalIntMap m -> m
forall a. MonoidalIntMap a -> Bool
forall a. MonoidalIntMap a -> Int
forall a. MonoidalIntMap a -> [a]
forall a. (a -> a -> a) -> MonoidalIntMap a -> a
forall m a. Monoid m => (a -> m) -> MonoidalIntMap a -> m
forall b a. (b -> a -> b) -> b -> MonoidalIntMap a -> b
forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => MonoidalIntMap a -> a
$cproduct :: forall a. Num a => MonoidalIntMap a -> a
sum :: forall a. Num a => MonoidalIntMap a -> a
$csum :: forall a. Num a => MonoidalIntMap a -> a
minimum :: forall a. Ord a => MonoidalIntMap a -> a
$cminimum :: forall a. Ord a => MonoidalIntMap a -> a
maximum :: forall a. Ord a => MonoidalIntMap a -> a
$cmaximum :: forall a. Ord a => MonoidalIntMap a -> a
elem :: forall a. Eq a => a -> MonoidalIntMap a -> Bool
$celem :: forall a. Eq a => a -> MonoidalIntMap a -> Bool
length :: forall a. MonoidalIntMap a -> Int
$clength :: forall a. MonoidalIntMap a -> Int
null :: forall a. MonoidalIntMap a -> Bool
$cnull :: forall a. MonoidalIntMap a -> Bool
toList :: forall a. MonoidalIntMap a -> [a]
$ctoList :: forall a. MonoidalIntMap a -> [a]
foldl1 :: forall a. (a -> a -> a) -> MonoidalIntMap a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> MonoidalIntMap a -> a
foldr1 :: forall a. (a -> a -> a) -> MonoidalIntMap a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> MonoidalIntMap a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> MonoidalIntMap a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> MonoidalIntMap a -> b
foldl :: forall b a. (b -> a -> b) -> b -> MonoidalIntMap a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> MonoidalIntMap a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b
foldr :: forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> MonoidalIntMap a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> MonoidalIntMap a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> MonoidalIntMap a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> MonoidalIntMap a -> m
fold :: forall m. Monoid m => MonoidalIntMap m -> m
$cfold :: forall m. Monoid m => MonoidalIntMap m -> m
Foldable, Functor MonoidalIntMap
Foldable MonoidalIntMap
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
MonoidalIntMap (m a) -> m (MonoidalIntMap a)
forall (f :: * -> *) a.
Applicative f =>
MonoidalIntMap (f a) -> f (MonoidalIntMap a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> MonoidalIntMap a -> m (MonoidalIntMap b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> MonoidalIntMap a -> f (MonoidalIntMap b)
sequence :: forall (m :: * -> *) a.
Monad m =>
MonoidalIntMap (m a) -> m (MonoidalIntMap a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
MonoidalIntMap (m a) -> m (MonoidalIntMap a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> MonoidalIntMap a -> m (MonoidalIntMap b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> MonoidalIntMap a -> m (MonoidalIntMap b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
MonoidalIntMap (f a) -> f (MonoidalIntMap a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
MonoidalIntMap (f a) -> f (MonoidalIntMap a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> MonoidalIntMap a -> f (MonoidalIntMap b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> MonoidalIntMap a -> f (MonoidalIntMap b)
Traversable,
              Value -> Parser [MonoidalIntMap a]
Value -> Parser (MonoidalIntMap a)
forall a. FromJSON a => Value -> Parser [MonoidalIntMap a]
forall a. FromJSON a => Value -> Parser (MonoidalIntMap a)
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [MonoidalIntMap a]
$cparseJSONList :: forall a. FromJSON a => Value -> Parser [MonoidalIntMap a]
parseJSON :: Value -> Parser (MonoidalIntMap a)
$cparseJSON :: forall a. FromJSON a => Value -> Parser (MonoidalIntMap a)
FromJSON, [MonoidalIntMap a] -> Encoding
[MonoidalIntMap a] -> Value
MonoidalIntMap a -> Encoding
MonoidalIntMap a -> Value
forall a. ToJSON a => [MonoidalIntMap a] -> Encoding
forall a. ToJSON a => [MonoidalIntMap a] -> Value
forall a. ToJSON a => MonoidalIntMap a -> Encoding
forall a. ToJSON a => MonoidalIntMap a -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [MonoidalIntMap a] -> Encoding
$ctoEncodingList :: forall a. ToJSON a => [MonoidalIntMap a] -> Encoding
toJSONList :: [MonoidalIntMap a] -> Value
$ctoJSONList :: forall a. ToJSON a => [MonoidalIntMap a] -> Value
toEncoding :: MonoidalIntMap a -> Encoding
$ctoEncoding :: forall a. ToJSON a => MonoidalIntMap a -> Encoding
toJSON :: MonoidalIntMap a -> Value
$ctoJSON :: forall a. ToJSON a => MonoidalIntMap a -> Value
ToJSON, forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser [MonoidalIntMap a]
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser (MonoidalIntMap a)
forall (f :: * -> *).
(forall a.
 (Value -> Parser a)
 -> (Value -> Parser [a]) -> Value -> Parser (f a))
-> (forall a.
    (Value -> Parser a)
    -> (Value -> Parser [a]) -> Value -> Parser [f a])
-> FromJSON1 f
liftParseJSONList :: forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser [MonoidalIntMap a]
$cliftParseJSONList :: forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser [MonoidalIntMap a]
liftParseJSON :: forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser (MonoidalIntMap a)
$cliftParseJSON :: forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser (MonoidalIntMap a)
FromJSON1, forall a.
(a -> Encoding)
-> ([a] -> Encoding) -> [MonoidalIntMap a] -> Encoding
forall a.
(a -> Encoding)
-> ([a] -> Encoding) -> MonoidalIntMap a -> Encoding
forall a.
(a -> Value) -> ([a] -> Value) -> [MonoidalIntMap a] -> Value
forall a.
(a -> Value) -> ([a] -> Value) -> MonoidalIntMap a -> Value
forall (f :: * -> *).
(forall a. (a -> Value) -> ([a] -> Value) -> f a -> Value)
-> (forall a. (a -> Value) -> ([a] -> Value) -> [f a] -> Value)
-> (forall a.
    (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding)
-> (forall a.
    (a -> Encoding) -> ([a] -> Encoding) -> [f a] -> Encoding)
-> ToJSON1 f
liftToEncodingList :: forall a.
(a -> Encoding)
-> ([a] -> Encoding) -> [MonoidalIntMap a] -> Encoding
$cliftToEncodingList :: forall a.
(a -> Encoding)
-> ([a] -> Encoding) -> [MonoidalIntMap a] -> Encoding
liftToEncoding :: forall a.
(a -> Encoding)
-> ([a] -> Encoding) -> MonoidalIntMap a -> Encoding
$cliftToEncoding :: forall a.
(a -> Encoding)
-> ([a] -> Encoding) -> MonoidalIntMap a -> Encoding
liftToJSONList :: forall a.
(a -> Value) -> ([a] -> Value) -> [MonoidalIntMap a] -> Value
$cliftToJSONList :: forall a.
(a -> Value) -> ([a] -> Value) -> [MonoidalIntMap a] -> Value
liftToJSON :: forall a.
(a -> Value) -> ([a] -> Value) -> MonoidalIntMap a -> Value
$cliftToJSON :: forall a.
(a -> Value) -> ([a] -> Value) -> MonoidalIntMap a -> Value
ToJSON1,
              MonoidalIntMap a -> DataType
MonoidalIntMap a -> Constr
forall {a}. Data a => Typeable (MonoidalIntMap a)
forall a. Data a => MonoidalIntMap a -> DataType
forall a. Data a => MonoidalIntMap a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b)
-> MonoidalIntMap a -> MonoidalIntMap a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> MonoidalIntMap a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> MonoidalIntMap a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MonoidalIntMap a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MonoidalIntMap a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> MonoidalIntMap a -> m (MonoidalIntMap a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> MonoidalIntMap a -> m (MonoidalIntMap a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MonoidalIntMap a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MonoidalIntMap a -> c (MonoidalIntMap a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (MonoidalIntMap a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MonoidalIntMap a))
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MonoidalIntMap a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MonoidalIntMap a -> c (MonoidalIntMap a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (MonoidalIntMap a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> MonoidalIntMap a -> m (MonoidalIntMap a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> MonoidalIntMap a -> m (MonoidalIntMap a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> MonoidalIntMap a -> m (MonoidalIntMap a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> MonoidalIntMap a -> m (MonoidalIntMap a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> MonoidalIntMap a -> m (MonoidalIntMap a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> MonoidalIntMap a -> m (MonoidalIntMap a)
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> MonoidalIntMap a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> MonoidalIntMap a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> MonoidalIntMap a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> MonoidalIntMap a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MonoidalIntMap a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MonoidalIntMap a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MonoidalIntMap a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MonoidalIntMap a -> r
gmapT :: (forall b. Data b => b -> b)
-> MonoidalIntMap a -> MonoidalIntMap a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b)
-> MonoidalIntMap a -> MonoidalIntMap a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MonoidalIntMap a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MonoidalIntMap a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (MonoidalIntMap a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (MonoidalIntMap a))
dataTypeOf :: MonoidalIntMap a -> DataType
$cdataTypeOf :: forall a. Data a => MonoidalIntMap a -> DataType
toConstr :: MonoidalIntMap a -> Constr
$ctoConstr :: forall a. Data a => MonoidalIntMap a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MonoidalIntMap a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MonoidalIntMap a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MonoidalIntMap a -> c (MonoidalIntMap a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MonoidalIntMap a -> c (MonoidalIntMap a)
Data, Typeable, Semialign MonoidalIntMap
forall a. MonoidalIntMap a
forall (f :: * -> *). Semialign f -> (forall a. f a) -> Align f
nil :: forall a. MonoidalIntMap a
$cnil :: forall a. MonoidalIntMap a
Align
#if MIN_VERSION_these(0,8,0)
             , Functor MonoidalIntMap
forall a b.
MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap (These a b)
forall a b c.
(These a b -> c)
-> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
forall (f :: * -> *).
Functor f
-> (forall a b. f a -> f b -> f (These a b))
-> (forall a b c. (These a b -> c) -> f a -> f b -> f c)
-> Semialign f
alignWith :: forall a b c.
(These a b -> c)
-> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
$calignWith :: forall a b c.
(These a b -> c)
-> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
align :: forall a b.
MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap (These a b)
$calign :: forall a b.
MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap (These a b)
Semialign
#endif
#ifdef MIN_VERSION_semialign
             , Semialign MonoidalIntMap
forall a b.
MonoidalIntMap (These a b) -> (MonoidalIntMap a, MonoidalIntMap b)
forall c a b.
(c -> These a b)
-> MonoidalIntMap c -> (MonoidalIntMap a, MonoidalIntMap b)
forall (f :: * -> *).
Semialign f
-> (forall a b. f (These a b) -> (f a, f b))
-> (forall c a b. (c -> These a b) -> f c -> (f a, f b))
-> Unalign f
unalignWith :: forall c a b.
(c -> These a b)
-> MonoidalIntMap c -> (MonoidalIntMap a, MonoidalIntMap b)
$cunalignWith :: forall c a b.
(c -> These a b)
-> MonoidalIntMap c -> (MonoidalIntMap a, MonoidalIntMap b)
unalign :: forall a b.
MonoidalIntMap (These a b) -> (MonoidalIntMap a, MonoidalIntMap b)
$cunalign :: forall a b.
MonoidalIntMap (These a b) -> (MonoidalIntMap a, MonoidalIntMap b)
Unalign
#if MIN_VERSION_semialign(1,1,0)
             , Semialign MonoidalIntMap
forall a b.
MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap (a, b)
forall a b c.
(a -> b -> c)
-> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
forall (f :: * -> *).
Semialign f
-> (forall a b. f a -> f b -> f (a, b))
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> Zip f
zipWith :: forall a b c.
(a -> b -> c)
-> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
$czipWith :: forall a b c.
(a -> b -> c)
-> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
zip :: forall a b.
MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap (a, b)
$czip :: forall a b.
MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap (a, b)
Zip
#endif
#endif
             , Functor MonoidalIntMap
forall a. MonoidalIntMap (Maybe a) -> MonoidalIntMap a
forall a. (a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a
forall a b. (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b
forall (f :: * -> *).
Functor f
-> (forall a b. (a -> Maybe b) -> f a -> f b)
-> (forall a. f (Maybe a) -> f a)
-> (forall a. (a -> Bool) -> f a -> f a)
-> Filterable f
filter :: forall a. (a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a
$cfilter :: forall a. (a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a
catMaybes :: forall a. MonoidalIntMap (Maybe a) -> MonoidalIntMap a
$ccatMaybes :: forall a. MonoidalIntMap (Maybe a) -> MonoidalIntMap a
mapMaybe :: forall a b. (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b
$cmapMaybe :: forall a b. (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b
Witherable.Filterable
             )

deriving instance Eq1 MonoidalIntMap
deriving instance Ord1 MonoidalIntMap
deriving instance Show1 MonoidalIntMap

type instance Index (MonoidalIntMap a) = Int
type instance IxValue (MonoidalIntMap a) = a
instance Ixed (MonoidalIntMap a) where
    ix :: Index (MonoidalIntMap a)
-> Traversal' (MonoidalIntMap a) (IxValue (MonoidalIntMap a))
ix Index (MonoidalIntMap a)
k IxValue (MonoidalIntMap a) -> f (IxValue (MonoidalIntMap a))
f (MonoidalIntMap IntMap a
m) = case forall a. Int -> IntMap a -> Maybe a
M.lookup Index (MonoidalIntMap a)
k IntMap a
m of
      Just a
v  -> IxValue (MonoidalIntMap a) -> f (IxValue (MonoidalIntMap a))
f a
v forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
v' -> forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap (forall a. Int -> a -> IntMap a -> IntMap a
M.insert Index (MonoidalIntMap a)
k a
v' IntMap a
m)
      Maybe a
Nothing -> forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap IntMap a
m)
    {-# INLINE ix #-}

instance At (MonoidalIntMap a) where
    at :: Index (MonoidalIntMap a)
-> Lens' (MonoidalIntMap a) (Maybe (IxValue (MonoidalIntMap a)))
at Index (MonoidalIntMap a)
k Maybe (IxValue (MonoidalIntMap a))
-> f (Maybe (IxValue (MonoidalIntMap a)))
f (MonoidalIntMap IntMap a
m) = Maybe (IxValue (MonoidalIntMap a))
-> f (Maybe (IxValue (MonoidalIntMap a)))
f Maybe a
mv forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \Maybe a
r -> case Maybe a
r of
      Maybe a
Nothing -> forall b a. b -> (a -> b) -> Maybe a -> b
maybe (forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap IntMap a
m) (forall a b. a -> b -> a
const (forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall a b. (a -> b) -> a -> b
$ forall a. Int -> IntMap a -> IntMap a
M.delete Index (MonoidalIntMap a)
k IntMap a
m)) Maybe a
mv
      Just a
v' -> forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall a b. (a -> b) -> a -> b
$ forall a. Int -> a -> IntMap a -> IntMap a
M.insert Index (MonoidalIntMap a)
k a
v' IntMap a
m
      where mv :: Maybe a
mv = forall a. Int -> IntMap a -> Maybe a
M.lookup Index (MonoidalIntMap a)
k IntMap a
m
    {-# INLINE at #-}

instance Each (MonoidalIntMap a) (MonoidalIntMap b) a b

instance FunctorWithIndex Int MonoidalIntMap 
instance FoldableWithIndex Int MonoidalIntMap
instance TraversableWithIndex Int MonoidalIntMap where
    itraverse :: forall (f :: * -> *) a b.
Applicative f =>
(Int -> a -> f b) -> MonoidalIntMap a -> f (MonoidalIntMap b)
itraverse Int -> a -> f b
f (MonoidalIntMap IntMap a
m) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall a b. (a -> b) -> a -> b
$ forall i (t :: * -> *) (f :: * -> *) a b.
(TraversableWithIndex i t, Applicative f) =>
(i -> a -> f b) -> t a -> f (t b)
itraverse Int -> a -> f b
f IntMap a
m
    {-# INLINE itraverse #-}

instance TraverseMin Int MonoidalIntMap  where
    traverseMin :: forall v. IndexedTraversal' Int (MonoidalIntMap v) v
traverseMin p v (f v)
f (MonoidalIntMap IntMap v
m) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall a b. (a -> b) -> a -> b
$ forall k (m :: * -> *) v.
TraverseMin k m =>
IndexedTraversal' k (m v) v
traverseMin p v (f v)
f IntMap v
m
    {-# INLINE traverseMin #-}
instance TraverseMax Int MonoidalIntMap where
    traverseMax :: forall v. IndexedTraversal' Int (MonoidalIntMap v) v
traverseMax p v (f v)
f (MonoidalIntMap IntMap v
m) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall a b. (a -> b) -> a -> b
$ forall k (m :: * -> *) v.
TraverseMax k m =>
IndexedTraversal' k (m v) v
traverseMax p v (f v)
f IntMap v
m
    {-# INLINE traverseMax #-}

instance AsEmpty (MonoidalIntMap a) where
    _Empty :: Prism' (MonoidalIntMap a) ()
_Empty = forall a. a -> (a -> Bool) -> Prism' a ()
nearly (forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall a. IntMap a
M.empty) (forall a. IntMap a -> Bool
M.null forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n o. Newtype n o => n -> o
unpack)
    {-# INLINE _Empty #-}

instance Wrapped (MonoidalIntMap a) where
    type Unwrapped (MonoidalIntMap a) = M.IntMap a
    _Wrapped' :: Iso' (MonoidalIntMap a) (Unwrapped (MonoidalIntMap a))
_Wrapped' = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso forall n o. Newtype n o => n -> o
unpack forall n o. Newtype n o => o -> n
pack
    {-# INLINE _Wrapped' #-}

instance Semigroup a => Semigroup (MonoidalIntMap a) where
    MonoidalIntMap IntMap a
a <> :: MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
<> MonoidalIntMap IntMap a
b = forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall a b. (a -> b) -> a -> b
$ forall a. (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
M.unionWith forall a. Semigroup a => a -> a -> a
(<>) IntMap a
a IntMap a
b
    {-# INLINE (<>) #-}

instance Semigroup a => Monoid (MonoidalIntMap a) where
    mempty :: MonoidalIntMap a
mempty = forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall a. Monoid a => a
mempty
    {-# INLINE mempty #-}
#if !(MIN_VERSION_base(4,11,0))
    mappend (MonoidalIntMap a) (MonoidalIntMap b) = MonoidalIntMap $ M.unionWith (<>) a b
    {-# INLINE mappend #-}
#endif

instance Newtype (MonoidalIntMap a) (M.IntMap a) where
    pack :: IntMap a -> MonoidalIntMap a
pack = forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap
    {-# INLINE pack #-}
    unpack :: MonoidalIntMap a -> IntMap a
unpack (MonoidalIntMap IntMap a
a) = IntMap a
a
    {-# INLINE unpack #-}

#if MIN_VERSION_base(4,7,0)
instance Semigroup a => IsList.IsList (MonoidalIntMap a) where
    type Item (MonoidalIntMap a) = (Int, a)
    fromList :: [Item (MonoidalIntMap a)] -> MonoidalIntMap a
fromList = forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (a -> a -> a) -> [(Int, a)] -> IntMap a
M.fromListWith forall a. Semigroup a => a -> a -> a
(<>)
    {-# INLINE fromList #-}
    toList :: MonoidalIntMap a -> [Item (MonoidalIntMap a)]
toList = forall a. IntMap a -> [(Int, a)]
M.toList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n o. Newtype n o => n -> o
unpack
    {-# INLINE toList #-}
#endif

instance Witherable.Witherable MonoidalIntMap

-- | /O(1)/. A map with a single element.
singleton :: Int -> a -> MonoidalIntMap a
singleton :: forall a. Int -> a -> MonoidalIntMap a
singleton Int
k a
a = forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall a b. (a -> b) -> a -> b
$ forall a. Int -> a -> IntMap a
M.singleton Int
k a
a
{-# INLINE singleton #-}

-- | /O(1)/. The number of elements in the map.
size :: MonoidalIntMap a -> Int
size :: forall a. MonoidalIntMap a -> Int
size = forall a. IntMap a -> Int
M.size forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n o. Newtype n o => n -> o
unpack
{-# INLINE size #-}

-- | /O(log n)/. Is the key a member of the map? See also 'notMember'.
member :: Int -> MonoidalIntMap a -> Bool
member :: forall a. Int -> MonoidalIntMap a -> Bool
member Int
k = forall a. Int -> IntMap a -> Bool
M.member Int
k forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n o. Newtype n o => n -> o
unpack
{-# INLINE member #-}

-- | /O(log n)/. Is the key not a member of the map? See also 'member'.
notMember :: Int -> MonoidalIntMap a -> Bool
notMember :: forall a. Int -> MonoidalIntMap a -> Bool
notMember Int
k = Bool -> Bool
not forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Int -> IntMap a -> Bool
M.member Int
k forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n o. Newtype n o => n -> o
unpack
{-# INLINE notMember #-}

-- | /O(log n)/. The expression @('findWithDefault' def k map)@ returns
-- the value at key @k@ or returns default value @def@
-- when the key is not in the map.
findWithDefault :: forall a. a -> Int -> MonoidalIntMap a -> a
findWithDefault :: forall a. a -> Int -> MonoidalIntMap a -> a
findWithDefault a
def Int
k = forall a. a -> Int -> IntMap a -> a
M.findWithDefault a
def Int
k forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n o. Newtype n o => n -> o
unpack
{-# INLINE findWithDefault #-}

-- | /O(log n)/. Delete a key and its value from the map. When the key is not
-- a member of the map, the original map is returned.
delete :: Int -> MonoidalIntMap a -> MonoidalIntMap a
delete :: forall a. Int -> MonoidalIntMap a -> MonoidalIntMap a
delete Int
k = forall s. Wrapped s => (Unwrapped s -> s) -> Iso' s (Unwrapped s)
_Wrapping' forall a. IntMap a -> MonoidalIntMap a
MonoidalIntMap forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ forall a. Int -> IntMap a -> IntMap a
M.delete Int
k
{-# INLINE delete #-}

-- | /O(n)/. Return all elements of the map and their keys
assocs :: MonoidalIntMap a -> [(Int,a)]
assocs :: forall a. MonoidalIntMap a -> [(Int, a)]
assocs = forall a. IntMap a -> [(Int, a)]
M.assocs forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n o. Newtype n o => n -> o
unpack
{-# INLINE assocs #-}

-- | /O(n)/. Return all elements of the map in the ascending order of their
-- keys. Subject to list fusion.
elems :: MonoidalIntMap a -> [a]
elems :: forall a. MonoidalIntMap a -> [a]
elems = forall a. IntMap a -> [a]
M.elems forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n o. Newtype n o => n -> o
unpack
{-# INLINE elems #-}

-- | /O(n)/. Return all keys of the map in ascending order. Subject to list
-- fusion.
keys :: MonoidalIntMap a -> [Int]
keys :: forall a. MonoidalIntMap a -> [Int]
keys = forall a. IntMap a -> [Int]
M.keys forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n o. Newtype n o => n -> o
unpack
{-# INLINE keys #-}

(!) :: forall a. MonoidalIntMap a -> Int -> a
! :: forall a. MonoidalIntMap a -> Int -> a
(!) = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> Int -> a
(M.!) :: M.IntMap a -> Int -> a)
infixl 9 !

(\\) :: forall a b. MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
\\ :: forall a b.
MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
(\\) = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. IntMap a -> IntMap b -> IntMap a
(M.\\) :: M.IntMap a -> M.IntMap b -> M.IntMap a)
infixl 9 \\ --

null :: forall a. MonoidalIntMap a -> Bool
null :: forall a. MonoidalIntMap a -> Bool
null = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> Bool
M.null :: M.IntMap a -> Bool)
{-# INLINE null #-}

lookup :: forall a. Int -> MonoidalIntMap a -> Maybe a
lookup :: forall a. Int -> MonoidalIntMap a -> Maybe a
lookup = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Int -> IntMap a -> Maybe a
M.lookup :: Int -> M.IntMap a -> Maybe a)
{-# INLINE lookup #-}

lookupLT :: forall a. Int -> MonoidalIntMap a -> Maybe (Int, a)
lookupLT :: forall a. Int -> MonoidalIntMap a -> Maybe (Int, a)
lookupLT = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Int -> IntMap a -> Maybe (Int, a)
M.lookupLT :: Int -> M.IntMap a -> Maybe (Int,a))
{-# INLINE lookupLT #-}

lookupGT :: forall a. Int -> MonoidalIntMap a -> Maybe (Int, a)
lookupGT :: forall a. Int -> MonoidalIntMap a -> Maybe (Int, a)
lookupGT = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Int -> IntMap a -> Maybe (Int, a)
M.lookupGT :: Int -> M.IntMap a -> Maybe (Int,a))
{-# INLINE lookupGT #-}

lookupLE :: forall a. Int -> MonoidalIntMap a -> Maybe (Int, a)
lookupLE :: forall a. Int -> MonoidalIntMap a -> Maybe (Int, a)
lookupLE = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Int -> IntMap a -> Maybe (Int, a)
M.lookupLE :: Int -> M.IntMap a -> Maybe (Int,a))
{-# INLINE lookupLE #-}

lookupGE :: forall a. Int -> MonoidalIntMap a -> Maybe (Int, a)
lookupGE :: forall a. Int -> MonoidalIntMap a -> Maybe (Int, a)
lookupGE = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Int -> IntMap a -> Maybe (Int, a)
M.lookupGE :: Int -> M.IntMap a -> Maybe (Int,a))
{-# INLINE lookupGE #-}

empty :: forall a. MonoidalIntMap a
empty :: forall a. MonoidalIntMap a
empty = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a
M.empty :: M.IntMap a)
{-# INLINE empty #-}

insert :: forall a. Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
insert :: forall a. Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
insert = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Int -> a -> IntMap a -> IntMap a
M.insert :: Int -> a -> M.IntMap a -> M.IntMap a)
{-# INLINE insert #-}

insertWith :: forall a. (a -> a -> a) -> Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
insertWith :: forall a.
(a -> a -> a) -> Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
insertWith = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> a -> a) -> Int -> a -> IntMap a -> IntMap a
M.insertWith :: (a -> a -> a) -> Int -> a -> M.IntMap a -> M.IntMap a)
{-# INLINE insertWith #-}

insertWithKey :: forall a. (Int -> a -> a -> a) -> Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
insertWithKey :: forall a.
(Int -> a -> a -> a)
-> Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
insertWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a -> a -> a) -> Int -> a -> IntMap a -> IntMap a
M.insertWithKey :: (Int -> a -> a -> a) -> Int -> a -> M.IntMap a -> M.IntMap a)
{-# INLINE insertWithKey #-}

insertLookupWithKey :: forall a. (Int -> a -> a -> a) -> Int -> a -> MonoidalIntMap a -> (Maybe a, MonoidalIntMap a)
insertLookupWithKey :: forall a.
(Int -> a -> a -> a)
-> Int -> a -> MonoidalIntMap a -> (Maybe a, MonoidalIntMap a)
insertLookupWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a.
(Int -> a -> a -> a) -> Int -> a -> IntMap a -> (Maybe a, IntMap a)
M.insertLookupWithKey :: (Int -> a -> a -> a) -> Int -> a -> M.IntMap a -> (Maybe a, M.IntMap a))
{-# INLINE insertLookupWithKey #-}

adjust :: forall a. (a -> a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
adjust :: forall a. (a -> a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
adjust = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> a) -> Int -> IntMap a -> IntMap a
M.adjust :: (a -> a) -> Int -> M.IntMap a -> M.IntMap a)
{-# INLINE adjust #-}

adjustWithKey :: forall a. (Int -> a -> a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
adjustWithKey :: forall a.
(Int -> a -> a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
adjustWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a -> a) -> Int -> IntMap a -> IntMap a
M.adjustWithKey :: (Int -> a -> a) -> Int -> M.IntMap a -> M.IntMap a)
{-# INLINE adjustWithKey #-}

update :: forall a. (a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
update :: forall a.
(a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
update = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> Maybe a) -> Int -> IntMap a -> IntMap a
M.update :: (a -> Maybe a) -> Int -> M.IntMap a -> M.IntMap a)
{-# INLINE update #-}

updateWithKey :: forall a. (Int -> a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
updateWithKey :: forall a.
(Int -> a -> Maybe a)
-> Int -> MonoidalIntMap a -> MonoidalIntMap a
updateWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a -> Maybe a) -> Int -> IntMap a -> IntMap a
M.updateWithKey :: (Int -> a -> Maybe a) -> Int -> M.IntMap a -> M.IntMap a)
{-# INLINE updateWithKey #-}

updateLookupWithKey :: forall a. (Int -> a -> Maybe a) -> Int -> MonoidalIntMap a -> (Maybe a, MonoidalIntMap a)
updateLookupWithKey :: forall a.
(Int -> a -> Maybe a)
-> Int -> MonoidalIntMap a -> (Maybe a, MonoidalIntMap a)
updateLookupWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a.
(Int -> a -> Maybe a) -> Int -> IntMap a -> (Maybe a, IntMap a)
M.updateLookupWithKey :: (Int -> a -> Maybe a) -> Int -> M.IntMap a -> (Maybe a, M.IntMap a))
{-# INLINE updateLookupWithKey #-}

alter :: forall a. (Maybe a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
alter :: forall a.
(Maybe a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
alter = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Maybe a -> Maybe a) -> Int -> IntMap a -> IntMap a
M.alter :: (Maybe a -> Maybe a) -> Int -> M.IntMap a -> M.IntMap a)
{-# INLINE alter #-}

unionWith :: forall a. (a -> a -> a) -> MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
unionWith :: forall a.
(a -> a -> a)
-> MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
unionWith = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
M.unionWith :: (a -> a -> a) -> M.IntMap a -> M.IntMap a -> M.IntMap a)
{-# INLINE unionWith #-}

unionWithKey :: forall a. (Int -> a -> a -> a) -> MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
unionWithKey :: forall a.
(Int -> a -> a -> a)
-> MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
unionWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
M.unionWithKey :: (Int -> a -> a -> a) -> M.IntMap a -> M.IntMap a -> M.IntMap a)
{-# INLINE unionWithKey #-}

unionsWith :: forall a. (a -> a -> a) -> [MonoidalIntMap a] -> MonoidalIntMap a
unionsWith :: forall a. (a -> a -> a) -> [MonoidalIntMap a] -> MonoidalIntMap a
unionsWith = coerce :: forall a b. Coercible a b => a -> b
coerce (forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> f (IntMap a) -> IntMap a
M.unionsWith :: (a -> a -> a) -> [M.IntMap a] -> M.IntMap a)
{-# INLINE unionsWith #-}

difference :: forall a b. MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
difference :: forall a b.
MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
difference = forall a b.
MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
(\\)
{-# INLINE difference #-}

differenceWith :: forall a b. (a -> b -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
differenceWith :: forall a b.
(a -> b -> Maybe a)
-> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
differenceWith = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
M.differenceWith :: (a -> b -> Maybe a) -> M.IntMap a -> M.IntMap b -> M.IntMap a)
{-# INLINE differenceWith #-}

differenceWithKey :: forall a b. (Int -> a -> b -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
differenceWithKey :: forall a b.
(Int -> a -> b -> Maybe a)
-> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
differenceWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b.
(Int -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
M.differenceWithKey :: (Int -> a -> b -> Maybe a) -> M.IntMap a -> M.IntMap b -> M.IntMap a)
{-# INLINE differenceWithKey #-}

intersectionWith :: forall a b c. (a -> b -> c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
intersectionWith :: forall a b c.
(a -> b -> c)
-> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
intersectionWith = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b c. (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
M.intersectionWith :: (a -> b -> c) -> M.IntMap a -> M.IntMap b -> M.IntMap c)
{-# INLINE intersectionWith #-}

intersectionWithKey :: forall a b c. (Int -> a -> b -> c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
intersectionWithKey :: forall a b c.
(Int -> a -> b -> c)
-> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
intersectionWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b c.
(Int -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
M.intersectionWithKey :: (Int -> a -> b -> c) -> M.IntMap a -> M.IntMap b -> M.IntMap c)
{-# INLINE intersectionWithKey #-}

mergeWithKey :: forall a b c. (Int -> a -> b -> Maybe c) -> (MonoidalIntMap a -> MonoidalIntMap c) -> (MonoidalIntMap b -> MonoidalIntMap c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
mergeWithKey :: forall a b c.
(Int -> a -> b -> Maybe c)
-> (MonoidalIntMap a -> MonoidalIntMap c)
-> (MonoidalIntMap b -> MonoidalIntMap c)
-> MonoidalIntMap a
-> MonoidalIntMap b
-> MonoidalIntMap c
mergeWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b c.
(Int -> a -> b -> Maybe c)
-> (IntMap a -> IntMap c)
-> (IntMap b -> IntMap c)
-> IntMap a
-> IntMap b
-> IntMap c
M.mergeWithKey :: (Int -> a -> b -> Maybe c) -> (M.IntMap a -> M.IntMap c) -> (M.IntMap b -> M.IntMap c) -> M.IntMap a -> M.IntMap b -> M.IntMap c)
{-# INLINE mergeWithKey #-}

map :: (a -> b) -> MonoidalIntMap a -> MonoidalIntMap b
map :: forall a b. (a -> b) -> MonoidalIntMap a -> MonoidalIntMap b
map = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
{-# INLINE map #-}

mapWithKey :: forall a  b. (Int -> a -> b) -> MonoidalIntMap a -> MonoidalIntMap b
mapWithKey :: forall a b. (Int -> a -> b) -> MonoidalIntMap a -> MonoidalIntMap b
mapWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (Int -> a -> b) -> IntMap a -> IntMap b
M.mapWithKey :: (Int -> a -> b) -> M.IntMap a -> M.IntMap b)
{-# INLINE mapWithKey #-}

traverseWithKey :: Applicative t => (Int -> a -> t b) -> MonoidalIntMap a -> t (MonoidalIntMap b)
traverseWithKey :: forall (f :: * -> *) a b.
Applicative f =>
(Int -> a -> f b) -> MonoidalIntMap a -> f (MonoidalIntMap b)
traverseWithKey = forall i (t :: * -> *) (f :: * -> *) a b.
(TraversableWithIndex i t, Applicative f) =>
(i -> a -> f b) -> t a -> f (t b)
itraverse
{-# INLINE traverseWithKey #-}

mapAccum :: forall a b c. (a -> b -> (a, c)) -> a -> MonoidalIntMap b -> (a, MonoidalIntMap c)
mapAccum :: forall a b c.
(a -> b -> (a, c))
-> a -> MonoidalIntMap b -> (a, MonoidalIntMap c)
mapAccum = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b c. (a -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
M.mapAccum :: (a -> b -> (a, c)) -> a -> M.IntMap b -> (a, M.IntMap c))
{-# INLINE mapAccum #-}

mapAccumWithKey :: forall a b c. (a -> Int -> b -> (a, c)) -> a -> MonoidalIntMap b -> (a, MonoidalIntMap c)
mapAccumWithKey :: forall a b c.
(a -> Int -> b -> (a, c))
-> a -> MonoidalIntMap b -> (a, MonoidalIntMap c)
mapAccumWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b c.
(a -> Int -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
M.mapAccumWithKey :: (a -> Int -> b -> (a, c)) -> a -> M.IntMap b -> (a, M.IntMap c))
{-# INLINE mapAccumWithKey #-}

mapAccumRWithKey :: forall a b c. (a -> Int -> b -> (a, c)) -> a -> MonoidalIntMap b -> (a, MonoidalIntMap c)
mapAccumRWithKey :: forall a b c.
(a -> Int -> b -> (a, c))
-> a -> MonoidalIntMap b -> (a, MonoidalIntMap c)
mapAccumRWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b c.
(a -> Int -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
M.mapAccumRWithKey :: (a -> Int -> b -> (a, c)) -> a -> M.IntMap b -> (a, M.IntMap c))
{-# INLINE mapAccumRWithKey #-}

mapKeys :: forall a. (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
mapKeys :: forall a. (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
mapKeys = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> Int) -> IntMap a -> IntMap a
M.mapKeys :: (Int -> Int) -> M.IntMap a -> M.IntMap a)
{-# INLINE mapKeys #-}

mapKeysWith :: forall a. (a -> a -> a) -> (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
mapKeysWith :: forall a.
(a -> a -> a)
-> (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
mapKeysWith = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> a -> a) -> (Int -> Int) -> IntMap a -> IntMap a
M.mapKeysWith :: (a -> a -> a) -> (Int -> Int) -> M.IntMap a -> M.IntMap a)
{-# INLINE mapKeysWith #-}

mapKeysMonotonic :: forall a. (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
mapKeysMonotonic :: forall a. (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
mapKeysMonotonic = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> Int) -> IntMap a -> IntMap a
M.mapKeysMonotonic :: (Int -> Int) -> M.IntMap a -> M.IntMap a)
{-# INLINE mapKeysMonotonic #-}

foldr :: forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b
foldr :: forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b
foldr = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (a -> b -> b) -> b -> IntMap a -> b
M.foldr :: (a -> b -> b) -> b -> M.IntMap a -> b)
{-# INLINE foldr #-}

foldl :: forall a b. (a -> b -> a) -> a -> MonoidalIntMap b -> a
foldl :: forall b a. (b -> a -> b) -> b -> MonoidalIntMap a -> b
foldl = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (a -> b -> a) -> a -> IntMap b -> a
M.foldl :: (a -> b -> a) -> a -> M.IntMap b -> a)
{-# INLINE foldl #-}

foldrWithKey :: forall a b. (Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b
foldrWithKey :: forall a b. (Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b
foldrWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (Int -> a -> b -> b) -> b -> IntMap a -> b
M.foldrWithKey :: (Int -> a -> b -> b) -> b -> M.IntMap a -> b)
{-# INLINE foldrWithKey #-}

foldlWithKey :: forall a b. (a -> Int -> b -> a) -> a -> MonoidalIntMap b -> a
foldlWithKey :: forall a b. (a -> Int -> b -> a) -> a -> MonoidalIntMap b -> a
foldlWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (a -> Int -> b -> a) -> a -> IntMap b -> a
M.foldlWithKey :: (a -> Int -> b -> a) -> a -> M.IntMap b -> a)
{-# INLINE foldlWithKey #-}

foldMapWithKey :: forall a m. Monoid m => (Int -> a -> m) -> MonoidalIntMap a -> m
foldMapWithKey :: forall a m. Monoid m => (Int -> a -> m) -> MonoidalIntMap a -> m
foldMapWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall m a. Monoid m => (Int -> a -> m) -> IntMap a -> m
M.foldMapWithKey :: Monoid m => (Int -> a -> m) -> M.IntMap a -> m)
{-# INLINE foldMapWithKey #-}

foldr' :: forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b
foldr' = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (a -> b -> b) -> b -> IntMap a -> b
M.foldr' :: (a -> b -> b) -> b -> M.IntMap a -> b)
{-# INLINE foldr' #-}

foldl' :: forall a b. (a -> b -> a) -> a -> MonoidalIntMap b -> a
foldl' :: forall b a. (b -> a -> b) -> b -> MonoidalIntMap a -> b
foldl' = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (a -> b -> a) -> a -> IntMap b -> a
M.foldl' :: (a -> b -> a) -> a -> M.IntMap b -> a)
{-# INLINE foldl' #-}

foldrWithKey' :: forall a b. (Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b
foldrWithKey' :: forall a b. (Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b
foldrWithKey' = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (Int -> a -> b -> b) -> b -> IntMap a -> b
M.foldrWithKey' :: (Int -> a -> b -> b) -> b -> M.IntMap a -> b)
{-# INLINE foldrWithKey' #-}

foldlWithKey' :: forall a b. (a -> Int -> b -> a) -> a -> MonoidalIntMap b -> a
foldlWithKey' :: forall a b. (a -> Int -> b -> a) -> a -> MonoidalIntMap b -> a
foldlWithKey' = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (a -> Int -> b -> a) -> a -> IntMap b -> a
M.foldlWithKey' :: (a -> Int -> b -> a) -> a -> M.IntMap b -> a)
{-# INLINE foldlWithKey' #-}

keysSet :: forall a. MonoidalIntMap a -> IntSet
keysSet :: forall a. MonoidalIntMap a -> IntSet
keysSet = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> IntSet
M.keysSet :: M.IntMap a -> IntSet)
{-# INLINE keysSet #-}

fromSet :: forall a. (Int -> a) -> IntSet -> MonoidalIntMap a
fromSet :: forall a. (Int -> a) -> IntSet -> MonoidalIntMap a
fromSet = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a) -> IntSet -> IntMap a
M.fromSet :: (Int -> a) -> IntSet -> M.IntMap a)
{-# INLINE fromSet #-}

toList :: forall a. MonoidalIntMap a -> [(Int, a)]
toList :: forall a. MonoidalIntMap a -> [(Int, a)]
toList = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> [(Int, a)]
M.toList :: M.IntMap a -> [(Int, a)])
{-# INLINE toList #-}

fromList :: forall a. [(Int, a)] -> MonoidalIntMap a
fromList :: forall a. [(Int, a)] -> MonoidalIntMap a
fromList = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. [(Int, a)] -> IntMap a
M.fromList :: [(Int, a)] -> M.IntMap a)
{-# INLINE fromList #-}

fromListWith :: forall a. (a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
fromListWith :: forall a. (a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
fromListWith = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> a -> a) -> [(Int, a)] -> IntMap a
M.fromListWith :: (a -> a -> a) -> [(Int, a)] -> M.IntMap a)
{-# INLINE fromListWith #-}

fromListWithKey :: forall a. (Int -> a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
fromListWithKey :: forall a. (Int -> a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
fromListWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a -> a -> a) -> [(Int, a)] -> IntMap a
M.fromListWithKey :: (Int -> a -> a -> a) -> [(Int, a)] -> M.IntMap a)
{-# INLINE fromListWithKey #-}

toAscList :: forall a. MonoidalIntMap a -> [(Int, a)]
toAscList :: forall a. MonoidalIntMap a -> [(Int, a)]
toAscList = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> [(Int, a)]
M.toAscList :: M.IntMap a -> [(Int, a)])
{-# INLINE toAscList #-}

toDescList :: forall a. MonoidalIntMap a -> [(Int, a)]
toDescList :: forall a. MonoidalIntMap a -> [(Int, a)]
toDescList = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> [(Int, a)]
M.toDescList :: M.IntMap a -> [(Int, a)])
{-# INLINE toDescList #-}

fromAscList :: forall a. [(Int, a)] -> MonoidalIntMap a
fromAscList :: forall a. [(Int, a)] -> MonoidalIntMap a
fromAscList = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. [(Int, a)] -> IntMap a
M.fromAscList :: [(Int, a)] -> M.IntMap a)
{-# INLINE fromAscList #-}

fromAscListWith :: forall a. (a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
fromAscListWith :: forall a. (a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
fromAscListWith = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> a -> a) -> [(Int, a)] -> IntMap a
M.fromAscListWith :: (a -> a -> a) -> [(Int, a)] -> M.IntMap a)
{-# INLINE fromAscListWith #-}

fromAscListWithKey :: forall a. (Int -> a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
fromAscListWithKey :: forall a. (Int -> a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
fromAscListWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a -> a -> a) -> [(Int, a)] -> IntMap a
M.fromAscListWithKey :: (Int -> a -> a -> a) -> [(Int, a)] -> M.IntMap a)
{-# INLINE fromAscListWithKey #-}

fromDistinctAscList :: forall a. [(Int, a)] -> MonoidalIntMap a
fromDistinctAscList :: forall a. [(Int, a)] -> MonoidalIntMap a
fromDistinctAscList = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. [(Int, a)] -> IntMap a
M.fromDistinctAscList :: [(Int, a)] -> M.IntMap a)
{-# INLINE fromDistinctAscList #-}

fromDistinctList :: forall a. [(Int, a)] -> MonoidalIntMap a
fromDistinctList :: forall a. [(Int, a)] -> MonoidalIntMap a
fromDistinctList = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. [(Int, a)] -> IntMap a
M.fromList :: [(Int, a)] -> M.IntMap a)
{-# INLINE fromDistinctList #-}

filter :: forall a. (a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a
filter :: forall a. (a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a
filter = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> Bool) -> IntMap a -> IntMap a
M.filter :: (a -> Bool) -> M.IntMap a -> M.IntMap a)
{-# INLINE filter #-}

filterWithKey :: forall a. (Int -> a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a
filterWithKey :: forall a.
(Int -> a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a
filterWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a -> Bool) -> IntMap a -> IntMap a
M.filterWithKey :: (Int -> a -> Bool) -> M.IntMap a -> M.IntMap a)
{-# INLINE filterWithKey #-}

partition :: forall a. (a -> Bool) -> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a)
partition :: forall a.
(a -> Bool)
-> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a)
partition = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> Bool) -> IntMap a -> (IntMap a, IntMap a)
M.partition :: (a -> Bool) -> M.IntMap a -> (M.IntMap a, M.IntMap a))
{-# INLINE partition #-}

partitionWithKey :: forall a. (Int -> a -> Bool) -> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a)
partitionWithKey :: forall a.
(Int -> a -> Bool)
-> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a)
partitionWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a -> Bool) -> IntMap a -> (IntMap a, IntMap a)
M.partitionWithKey :: (Int -> a -> Bool) -> M.IntMap a -> (M.IntMap a, M.IntMap a))
{-# INLINE partitionWithKey #-}

mapMaybe :: forall a b. (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b
mapMaybe :: forall a b. (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b
mapMaybe = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (a -> Maybe b) -> IntMap a -> IntMap b
M.mapMaybe :: (a -> Maybe b) -> M.IntMap a -> M.IntMap b)
{-# INLINE mapMaybe #-}

mapMaybeWithKey :: forall a b. (Int -> a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b
mapMaybeWithKey :: forall a b.
(Int -> a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b
mapMaybeWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (Int -> a -> Maybe b) -> IntMap a -> IntMap b
M.mapMaybeWithKey :: (Int -> a -> Maybe b) -> M.IntMap a -> M.IntMap b)
{-# INLINE mapMaybeWithKey #-}

mapEither :: forall a b c. (a -> Either b c) -> MonoidalIntMap a -> (MonoidalIntMap b, MonoidalIntMap c)
mapEither :: forall a b c.
(a -> Either b c)
-> MonoidalIntMap a -> (MonoidalIntMap b, MonoidalIntMap c)
mapEither = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b c. (a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
M.mapEither :: (a -> Either b c) -> M.IntMap a -> (M.IntMap b, M.IntMap c))
{-# INLINE mapEither #-}

mapEitherWithKey :: forall a b c. (Int -> a -> Either b c) -> MonoidalIntMap a -> (MonoidalIntMap b, MonoidalIntMap c)
mapEitherWithKey :: forall a b c.
(Int -> a -> Either b c)
-> MonoidalIntMap a -> (MonoidalIntMap b, MonoidalIntMap c)
mapEitherWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b c.
(Int -> a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
M.mapEitherWithKey :: (Int -> a -> Either b c) -> M.IntMap a -> (M.IntMap b, M.IntMap c))
{-# INLINE mapEitherWithKey #-}

split :: forall a. Int -> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a)
split :: forall a.
Int -> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a)
split = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Int -> IntMap a -> (IntMap a, IntMap a)
M.split :: Int -> M.IntMap a -> (M.IntMap a, M.IntMap a))
{-# INLINE split #-}

splitLookup :: forall a. Int -> MonoidalIntMap a -> (MonoidalIntMap a, Maybe a, MonoidalIntMap a)
splitLookup :: forall a.
Int
-> MonoidalIntMap a
-> (MonoidalIntMap a, Maybe a, MonoidalIntMap a)
splitLookup = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Int -> IntMap a -> (IntMap a, Maybe a, IntMap a)
M.splitLookup :: Int -> M.IntMap a -> (M.IntMap a, Maybe a, M.IntMap a))
{-# INLINE splitLookup #-}

splitRoot :: forall a. MonoidalIntMap a -> [MonoidalIntMap a]
splitRoot :: forall a. MonoidalIntMap a -> [MonoidalIntMap a]
splitRoot = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> [IntMap a]
M.splitRoot :: M.IntMap a -> [M.IntMap a])
{-# INLINE splitRoot #-}

isSubmapOf :: forall a. Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
isSubmapOf :: forall a. Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
isSubmapOf = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Eq a => IntMap a -> IntMap a -> Bool
M.isSubmapOf :: M.IntMap a -> M.IntMap a -> Bool)
{-# INLINE isSubmapOf #-}

isSubmapOfBy :: forall a b. (a -> b -> Bool) -> MonoidalIntMap a -> MonoidalIntMap b -> Bool
isSubmapOfBy :: forall a b.
(a -> b -> Bool) -> MonoidalIntMap a -> MonoidalIntMap b -> Bool
isSubmapOfBy = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (a -> b -> Bool) -> IntMap a -> IntMap b -> Bool
M.isSubmapOfBy :: (a -> b -> Bool) -> M.IntMap a -> M.IntMap b -> Bool)
{-# INLINE isSubmapOfBy #-}

isProperSubmapOf :: forall a. Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
isProperSubmapOf :: forall a. Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
isProperSubmapOf = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Eq a => IntMap a -> IntMap a -> Bool
M.isProperSubmapOf :: M.IntMap a -> M.IntMap a -> Bool)
{-# INLINE isProperSubmapOf #-}

isProperSubmapOfBy :: forall a b. (a -> b -> Bool) -> MonoidalIntMap a -> MonoidalIntMap b -> Bool
isProperSubmapOfBy :: forall a b.
(a -> b -> Bool) -> MonoidalIntMap a -> MonoidalIntMap b -> Bool
isProperSubmapOfBy = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a b. (a -> b -> Bool) -> IntMap a -> IntMap b -> Bool
M.isProperSubmapOfBy :: (a -> b -> Bool) -> M.IntMap a -> M.IntMap b -> Bool)
{-# INLINE isProperSubmapOfBy #-}

findMin :: forall a. MonoidalIntMap a -> (Int, a)
findMin :: forall a. MonoidalIntMap a -> (Int, a)
findMin = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> (Int, a)
M.findMin :: M.IntMap a -> (Int, a))
{-# INLINE findMin #-}

findMax :: forall a. MonoidalIntMap a -> (Int, a)
findMax :: forall a. MonoidalIntMap a -> (Int, a)
findMax = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> (Int, a)
M.findMax :: M.IntMap a -> (Int, a))
{-# INLINE findMax #-}

deleteMin :: forall a. MonoidalIntMap a -> MonoidalIntMap a
deleteMin :: forall a. MonoidalIntMap a -> MonoidalIntMap a
deleteMin = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> IntMap a
M.deleteMin :: M.IntMap a -> M.IntMap a)
{-# INLINE deleteMin #-}

deleteMax :: forall a. MonoidalIntMap a -> MonoidalIntMap a
deleteMax :: forall a. MonoidalIntMap a -> MonoidalIntMap a
deleteMax = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> IntMap a
M.deleteMax :: M.IntMap a -> M.IntMap a)
{-# INLINE deleteMax #-}

deleteFindMin :: forall a. MonoidalIntMap a -> ((Int, a), MonoidalIntMap a)
deleteFindMin :: forall a. MonoidalIntMap a -> ((Int, a), MonoidalIntMap a)
deleteFindMin = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> ((Int, a), IntMap a)
M.deleteFindMin :: M.IntMap a -> ((Int, a), M.IntMap a))
{-# INLINE deleteFindMin #-}

deleteFindMax :: forall a. MonoidalIntMap a -> ((Int, a), MonoidalIntMap a)
deleteFindMax :: forall a. MonoidalIntMap a -> ((Int, a), MonoidalIntMap a)
deleteFindMax = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> ((Int, a), IntMap a)
M.deleteFindMax :: M.IntMap a -> ((Int, a), M.IntMap a))
{-# INLINE deleteFindMax #-}

updateMin :: forall a. (a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
updateMin :: forall a. (a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
updateMin = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> Maybe a) -> IntMap a -> IntMap a
M.updateMin :: (a -> Maybe a) -> M.IntMap a -> M.IntMap a)
{-# INLINE updateMin #-}

updateMax :: forall a. (a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
updateMax :: forall a. (a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
updateMax = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (a -> Maybe a) -> IntMap a -> IntMap a
M.updateMax :: (a -> Maybe a) -> M.IntMap a -> M.IntMap a)
{-# INLINE updateMax #-}

updateMinWithKey :: forall a. (Int -> a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
updateMinWithKey :: forall a.
(Int -> a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
updateMinWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a -> Maybe a) -> IntMap a -> IntMap a
M.updateMinWithKey :: (Int -> a -> Maybe a) -> M.IntMap a -> M.IntMap a)
{-# INLINE updateMinWithKey #-}

updateMaxWithKey :: forall a. (Int -> a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
updateMaxWithKey :: forall a.
(Int -> a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
updateMaxWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. (Int -> a -> Maybe a) -> IntMap a -> IntMap a
M.updateMaxWithKey :: (Int -> a -> Maybe a) -> M.IntMap a -> M.IntMap a)
{-# INLINE updateMaxWithKey #-}

minView :: forall a. MonoidalIntMap a -> Maybe (a, MonoidalIntMap a)
minView :: forall a. MonoidalIntMap a -> Maybe (a, MonoidalIntMap a)
minView = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> Maybe (a, IntMap a)
M.minView :: M.IntMap a -> Maybe (a, M.IntMap a))
{-# INLINE minView #-}

maxView :: forall a. MonoidalIntMap a -> Maybe (a, MonoidalIntMap a)
maxView :: forall a. MonoidalIntMap a -> Maybe (a, MonoidalIntMap a)
maxView = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> Maybe (a, IntMap a)
M.maxView :: M.IntMap a -> Maybe (a, M.IntMap a))
{-# INLINE maxView #-}

minViewWithKey :: forall a. MonoidalIntMap a -> Maybe ((Int, a), MonoidalIntMap a)
minViewWithKey :: forall a. MonoidalIntMap a -> Maybe ((Int, a), MonoidalIntMap a)
minViewWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> Maybe ((Int, a), IntMap a)
M.minViewWithKey :: M.IntMap a -> Maybe ((Int, a), M.IntMap a))
{-# INLINE minViewWithKey #-}

maxViewWithKey :: forall a. MonoidalIntMap a -> Maybe ((Int, a), MonoidalIntMap a)
maxViewWithKey :: forall a. MonoidalIntMap a -> Maybe ((Int, a), MonoidalIntMap a)
maxViewWithKey = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. IntMap a -> Maybe ((Int, a), IntMap a)
M.maxViewWithKey :: M.IntMap a -> Maybe ((Int, a), M.IntMap a))
{-# INLINE maxViewWithKey #-}