Data.IntMap.Monoidal

monoidal-containers-0.6.5.0: Containers with monoidal accumulation

Safe Haskell | None
Language | Haskell2010

Data.IntMap.Monoidal

Contents

- Often-needed functions

Description

This module provides a `IntMap` variant which uses the value's `Monoid` instance to accumulate conflicting entries when merging `Map`s.

While some functions mirroring those of `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`.

Synopsis

- newtype MonoidalIntMap a = MonoidalIntMap {
  - getMonoidalIntMap :: IntMap a
  }
- singleton :: Int -> a -> MonoidalIntMap a
- size :: MonoidalIntMap a -> Int
- member :: Int -> MonoidalIntMap a -> Bool
- notMember :: Int -> MonoidalIntMap a -> Bool
- findWithDefault :: a -> Int -> MonoidalIntMap a -> a
- assocs :: MonoidalIntMap a -> [(Int, a)]
- elems :: MonoidalIntMap a -> [a]
- keys :: MonoidalIntMap a -> [Int]
- (!) :: MonoidalIntMap a -> Int -> a
- (\\) :: MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
- adjust :: (a -> a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
- adjustWithKey :: (Int -> a -> a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
- alter :: (Maybe a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
- delete :: Int -> MonoidalIntMap a -> MonoidalIntMap a
- deleteFindMax :: MonoidalIntMap a -> ((Int, a), MonoidalIntMap a)
- deleteFindMin :: MonoidalIntMap a -> ((Int, a), MonoidalIntMap a)
- deleteMax :: MonoidalIntMap a -> MonoidalIntMap a
- deleteMin :: MonoidalIntMap a -> MonoidalIntMap a
- difference :: MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
- differenceWith :: (a -> b -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
- differenceWithKey :: (Int -> a -> b -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a
- empty :: MonoidalIntMap a
- filter :: (a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a
- filterWithKey :: (Int -> a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a
- findMax :: MonoidalIntMap a -> (Int, a)
- findMin :: MonoidalIntMap a -> (Int, a)
- foldMapWithKey :: forall a m. Monoid m => (Int -> a -> m) -> MonoidalIntMap a -> m
- foldl :: (a -> b -> a) -> a -> MonoidalIntMap b -> a
- foldl' :: (a -> b -> a) -> a -> MonoidalIntMap b -> a
- foldlWithKey :: (a -> Int -> b -> a) -> a -> MonoidalIntMap b -> a
- foldlWithKey' :: (a -> Int -> b -> a) -> a -> MonoidalIntMap b -> a
- foldr :: (a -> b -> b) -> b -> MonoidalIntMap a -> b
- foldr' :: (a -> b -> b) -> b -> MonoidalIntMap a -> b
- foldrWithKey :: (Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b
- foldrWithKey' :: (Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b
- fromAscList :: [(Int, a)] -> MonoidalIntMap a
- fromAscListWith :: (a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
- fromAscListWithKey :: (Int -> a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
- fromDistinctAscList :: [(Int, a)] -> MonoidalIntMap a
- fromDistinctList :: [(Int, a)] -> MonoidalIntMap a
- fromList :: [(Int, a)] -> MonoidalIntMap a
- fromListWith :: (a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
- fromListWithKey :: (Int -> a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a
- fromSet :: (Int -> a) -> IntSet -> MonoidalIntMap a
- insert :: Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
- insertLookupWithKey :: (Int -> a -> a -> a) -> Int -> a -> MonoidalIntMap a -> (Maybe a, MonoidalIntMap a)
- insertWith :: (a -> a -> a) -> Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
- insertWithKey :: (Int -> a -> a -> a) -> Int -> a -> MonoidalIntMap a -> MonoidalIntMap a
- intersectionWith :: (a -> b -> c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
- intersectionWithKey :: (Int -> a -> b -> c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
- isProperSubmapOf :: Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
- isProperSubmapOfBy :: (a -> b -> Bool) -> MonoidalIntMap a -> MonoidalIntMap b -> Bool
- isSubmapOf :: Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool
- isSubmapOfBy :: (a -> b -> Bool) -> MonoidalIntMap a -> MonoidalIntMap b -> Bool
- keysSet :: MonoidalIntMap a -> IntSet
- lookup :: Int -> MonoidalIntMap a -> Maybe a
- lookupGE :: Int -> MonoidalIntMap a -> Maybe (Int, a)
- lookupGT :: Int -> MonoidalIntMap a -> Maybe (Int, a)
- lookupLE :: Int -> MonoidalIntMap a -> Maybe (Int, a)
- lookupLT :: Int -> MonoidalIntMap a -> Maybe (Int, a)
- map :: (a -> b) -> MonoidalIntMap a -> MonoidalIntMap b
- mapAccum :: (a -> b -> (a, c)) -> a -> MonoidalIntMap b -> (a, MonoidalIntMap c)
- mapAccumRWithKey :: (a -> Int -> b -> (a, c)) -> a -> MonoidalIntMap b -> (a, MonoidalIntMap c)
- mapAccumWithKey :: (a -> Int -> b -> (a, c)) -> a -> MonoidalIntMap b -> (a, MonoidalIntMap c)
- mapEither :: (a -> Either b c) -> MonoidalIntMap a -> (MonoidalIntMap b, MonoidalIntMap c)
- mapEitherWithKey :: (Int -> a -> Either b c) -> MonoidalIntMap a -> (MonoidalIntMap b, MonoidalIntMap c)
- mapKeys :: (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
- mapKeysMonotonic :: (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
- mapKeysWith :: (a -> a -> a) -> (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a
- mapMaybe :: (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b
- mapMaybeWithKey :: (Int -> a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b
- mapWithKey :: (Int -> a -> b) -> MonoidalIntMap a -> MonoidalIntMap b
- maxView :: MonoidalIntMap a -> Maybe (a, MonoidalIntMap a)
- maxViewWithKey :: MonoidalIntMap a -> Maybe ((Int, a), MonoidalIntMap a)
- mergeWithKey :: (Int -> a -> b -> Maybe c) -> (MonoidalIntMap a -> MonoidalIntMap c) -> (MonoidalIntMap b -> MonoidalIntMap c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c
- minView :: MonoidalIntMap a -> Maybe (a, MonoidalIntMap a)
- minViewWithKey :: MonoidalIntMap a -> Maybe ((Int, a), MonoidalIntMap a)
- null :: MonoidalIntMap a -> Bool
- partition :: (a -> Bool) -> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a)
- partitionWithKey :: (Int -> a -> Bool) -> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a)
- split :: Int -> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a)
- splitLookup :: Int -> MonoidalIntMap a -> (MonoidalIntMap a, Maybe a, MonoidalIntMap a)
- splitRoot :: MonoidalIntMap a -> [MonoidalIntMap a]
- toAscList :: MonoidalIntMap a -> [(Int, a)]
- toDescList :: MonoidalIntMap a -> [(Int, a)]
- toList :: MonoidalIntMap a -> [(Int, a)]
- traverseWithKey :: Applicative t => (Int -> a -> t b) -> MonoidalIntMap a -> t (MonoidalIntMap b)
- unionWith :: (a -> a -> a) -> MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
- unionWithKey :: (Int -> a -> a -> a) -> MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a
- unionsWith :: (a -> a -> a) -> [MonoidalIntMap a] -> MonoidalIntMap a
- update :: (a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a
- updateLookupWithKey :: (Int -> a -> Maybe a) -> Int -> MonoidalIntMap a -> (Maybe a, MonoidalIntMap a)
- updateMax :: (a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
- updateMaxWithKey :: (Int -> a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
- updateMin :: (a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
- updateMinWithKey :: (Int -> a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a
- updateWithKey :: (Int -> a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a

# Documentation

newtype MonoidalIntMap a #

An `IntMap` with monoidal accumulation

Constructors

MonoidalIntMap |
Fields getMonoidalIntMap :: IntMap a

#### Instances

Instances details

FromJSON1 MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (MonoidalIntMap a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [MonoidalIntMap a] # liftOmittedField :: Maybe a -> Maybe (MonoidalIntMap a) #
ToJSON1 MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> MonoidalIntMap a -> Value # liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [MonoidalIntMap a] -> Value # liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> MonoidalIntMap a -> Encoding # liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [MonoidalIntMap a] -> Encoding # liftOmitField :: (a -> Bool) -> MonoidalIntMap a -> Bool #
Eq1 MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods liftEq :: (a -> b -> Bool) -> MonoidalIntMap a -> MonoidalIntMap b -> Bool #
Ord1 MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods liftCompare :: (a -> b -> Ordering) -> MonoidalIntMap a -> MonoidalIntMap b -> Ordering #
Show1 MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> MonoidalIntMap a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [MonoidalIntMap a] -> ShowS #
Functor MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods fmap :: (a -> b) -> MonoidalIntMap a -> MonoidalIntMap b # (<$) :: a -> MonoidalIntMap b -> MonoidalIntMap a #
Foldable MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods fold :: Monoid m => MonoidalIntMap m -> m # foldMap :: Monoid m => (a -> m) -> MonoidalIntMap a -> m # foldMap' :: Monoid m => (a -> m) -> MonoidalIntMap a -> m # foldr :: (a -> b -> b) -> b -> MonoidalIntMap a -> b # foldr' :: (a -> b -> b) -> b -> MonoidalIntMap a -> b # foldl :: (b -> a -> b) -> b -> MonoidalIntMap a -> b # foldl' :: (b -> a -> b) -> b -> MonoidalIntMap a -> b # foldr1 :: (a -> a -> a) -> MonoidalIntMap a -> a # foldl1 :: (a -> a -> a) -> MonoidalIntMap a -> a # toList :: MonoidalIntMap a -> [a] # null :: MonoidalIntMap a -> Bool # length :: MonoidalIntMap a -> Int # elem :: Eq a => a -> MonoidalIntMap a -> Bool # maximum :: Ord a => MonoidalIntMap a -> a # minimum :: Ord a => MonoidalIntMap a -> a # sum :: Num a => MonoidalIntMap a -> a # product :: Num a => MonoidalIntMap a -> a #
Traversable MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods traverse :: Applicative f => (a -> f b) -> MonoidalIntMap a -> f (MonoidalIntMap b) # sequenceA :: Applicative f => MonoidalIntMap (f a) -> f (MonoidalIntMap a) # mapM :: Monad m => (a -> m b) -> MonoidalIntMap a -> m (MonoidalIntMap b) # sequence :: Monad m => MonoidalIntMap (m a) -> m (MonoidalIntMap a) #
Align MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods nil :: MonoidalIntMap a #
Semialign MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods align :: MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap (These a b) # alignWith :: (These a b -> c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c #
Unalign MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods unalign :: MonoidalIntMap (These a b) -> (MonoidalIntMap a, MonoidalIntMap b) # unalignWith :: (c -> These a b) -> MonoidalIntMap c -> (MonoidalIntMap a, MonoidalIntMap b) #
Zip MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods zip :: MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap (a, b) # zipWith :: (a -> b -> c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c #
Filterable MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods mapMaybe :: (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b # catMaybes :: MonoidalIntMap (Maybe a) -> MonoidalIntMap a # filter :: (a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a # drain :: MonoidalIntMap a -> MonoidalIntMap b #
Witherable MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods wither :: Applicative f => (a -> f (Maybe b)) -> MonoidalIntMap a -> f (MonoidalIntMap b) # witherM :: Monad m => (a -> m (Maybe b)) -> MonoidalIntMap a -> m (MonoidalIntMap b) # filterA :: Applicative f => (a -> f Bool) -> MonoidalIntMap a -> f (MonoidalIntMap a) # witherMap :: Applicative m => (MonoidalIntMap b -> r) -> (a -> m (Maybe b)) -> MonoidalIntMap a -> m r #
FoldableWithIndex Int MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods ifoldMap :: Monoid m => (Int -> a -> m) -> MonoidalIntMap a -> m # ifoldMap' :: Monoid m => (Int -> a -> m) -> MonoidalIntMap a -> m # ifoldr :: (Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b # ifoldl :: (Int -> b -> a -> b) -> b -> MonoidalIntMap a -> b # ifoldr' :: (Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b # ifoldl' :: (Int -> b -> a -> b) -> b -> MonoidalIntMap a -> b #
FunctorWithIndex Int MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods imap :: (Int -> a -> b) -> MonoidalIntMap a -> MonoidalIntMap b #
TraversableWithIndex Int MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods itraverse :: Applicative f => (Int -> a -> f b) -> MonoidalIntMap a -> f (MonoidalIntMap b) #
TraverseMax Int MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods traverseMax :: IndexedTraversal' Int (MonoidalIntMap v) v #
TraverseMin Int MonoidalIntMap # |
Instance details Defined in Data.IntMap.Monoidal Methods traverseMin :: IndexedTraversal' Int (MonoidalIntMap v) v #
FromJSON a => FromJSON (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods parseJSON :: Value -> Parser (MonoidalIntMap a) # parseJSONList :: Value -> Parser [MonoidalIntMap a] # omittedField :: Maybe (MonoidalIntMap a) #
ToJSON a => ToJSON (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods toJSON :: MonoidalIntMap a -> Value # toEncoding :: MonoidalIntMap a -> Encoding # toJSONList :: [MonoidalIntMap a] -> Value # toEncodingList :: [MonoidalIntMap a] -> Encoding # omitField :: MonoidalIntMap a -> Bool #
NFData a => NFData (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods rnf :: MonoidalIntMap a -> () #
Semigroup a => Monoid (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods mempty :: MonoidalIntMap a # mappend :: MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a # mconcat :: [MonoidalIntMap a] -> MonoidalIntMap a #
Semigroup a => Semigroup (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods (<>) :: MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a # sconcat :: NonEmpty (MonoidalIntMap a) -> MonoidalIntMap a # stimes :: Integral b => b -> MonoidalIntMap a -> MonoidalIntMap a #
Data a => Data (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MonoidalIntMap a -> c (MonoidalIntMap a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (MonoidalIntMap a) # toConstr :: MonoidalIntMap a -> Constr # dataTypeOf :: MonoidalIntMap a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (MonoidalIntMap a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (MonoidalIntMap a)) # gmapT :: (forall b. Data b => b -> b) -> MonoidalIntMap a -> MonoidalIntMap a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MonoidalIntMap a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MonoidalIntMap a -> r # gmapQ :: (forall d. Data d => d -> u) -> MonoidalIntMap a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> MonoidalIntMap a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> MonoidalIntMap a -> m (MonoidalIntMap a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MonoidalIntMap a -> m (MonoidalIntMap a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MonoidalIntMap a -> m (MonoidalIntMap a) #
Semigroup a => IsList (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Associated Types
type Item (MonoidalIntMap a) |
Instance details Defined in Data.IntMap.Monoidal type Item (MonoidalIntMap a) = (Int, a)
Methods fromList :: [Item (MonoidalIntMap a)] -> MonoidalIntMap a # fromListN :: Int -> [Item (MonoidalIntMap a)] -> MonoidalIntMap a # toList :: MonoidalIntMap a -> [Item (MonoidalIntMap a)] #
Read a => Read (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods readsPrec :: Int -> ReadS (MonoidalIntMap a) # readList :: ReadS [MonoidalIntMap a] # readPrec :: ReadPrec (MonoidalIntMap a) # readListPrec :: ReadPrec [MonoidalIntMap a] #
Show a => Show (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods showsPrec :: Int -> MonoidalIntMap a -> ShowS # show :: MonoidalIntMap a -> String # showList :: [MonoidalIntMap a] -> ShowS #
Eq a => Eq (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods (==) :: MonoidalIntMap a -> MonoidalIntMap a -> Bool # (/=) :: MonoidalIntMap a -> MonoidalIntMap a -> Bool #
Ord a => Ord (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods compare :: MonoidalIntMap a -> MonoidalIntMap a -> Ordering # (<) :: MonoidalIntMap a -> MonoidalIntMap a -> Bool # (<=) :: MonoidalIntMap a -> MonoidalIntMap a -> Bool # (>) :: MonoidalIntMap a -> MonoidalIntMap a -> Bool # (>=) :: MonoidalIntMap a -> MonoidalIntMap a -> Bool # max :: MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a # min :: MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a #
At (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods at :: Index (MonoidalIntMap a) -> Lens' (MonoidalIntMap a) (Maybe (IxValue (MonoidalIntMap a))) #
Ixed (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods ix :: Index (MonoidalIntMap a) -> Traversal' (MonoidalIntMap a) (IxValue (MonoidalIntMap a)) #
AsEmpty (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods _Empty :: Prism' (MonoidalIntMap a) () #
Wrapped (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Associated Types
type Unwrapped (MonoidalIntMap a) |
Instance details Defined in Data.IntMap.Monoidal type Unwrapped (MonoidalIntMap a) = IntMap a
Methods _Wrapped' :: Iso' (MonoidalIntMap a) (Unwrapped (MonoidalIntMap a)) #
Newtype (MonoidalIntMap a) (IntMap a) # |
Instance details Defined in Data.IntMap.Monoidal Methods pack :: IntMap a -> MonoidalIntMap a # unpack :: MonoidalIntMap a -> IntMap a #
Each (MonoidalIntMap a) (MonoidalIntMap b) a b # |
Instance details Defined in Data.IntMap.Monoidal Methods each :: Traversal (MonoidalIntMap a) (MonoidalIntMap b) a b #
type Item (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal type Item (MonoidalIntMap a) = (Int, a)
type Index (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal type Index (MonoidalIntMap a) = Int
type IxValue (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal type IxValue (MonoidalIntMap a) = a
type Unwrapped (MonoidalIntMap a) # |
Instance details Defined in Data.IntMap.Monoidal type Unwrapped (MonoidalIntMap a) = IntMap a

# Often-needed functions

singleton :: Int -> a -> MonoidalIntMap a #

O(1). A map with a single element.

size :: MonoidalIntMap a -> Int #

O(1). The number of elements in the map.

member :: Int -> MonoidalIntMap a -> Bool #

O(log n). Is the key a member of the map? See also `notMember`.

notMember :: Int -> MonoidalIntMap a -> Bool #

O(log n). Is the key not a member of the map? See also `member`.

findWithDefault :: a -> Int -> MonoidalIntMap a -> a #

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.

assocs :: MonoidalIntMap a -> [(Int, a)] #

O(n). Return all elements of the map and their keys

elems :: MonoidalIntMap a -> [a] #

O(n). Return all elements of the map in the ascending order of their keys. Subject to list fusion.

keys :: MonoidalIntMap a -> [Int] #

O(n). Return all keys of the map in ascending order. Subject to list fusion.

(!) :: MonoidalIntMap a -> Int -> a infixl 9 #

(\\) :: MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a infixl 9 #

adjust :: (a -> a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a #

adjustWithKey :: (Int -> a -> a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a #

alter :: (Maybe a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a #

delete :: Int -> MonoidalIntMap a -> MonoidalIntMap a #

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.

deleteFindMax :: MonoidalIntMap a -> ((Int, a), MonoidalIntMap a) #

deleteFindMin :: MonoidalIntMap a -> ((Int, a), MonoidalIntMap a) #

deleteMax :: MonoidalIntMap a -> MonoidalIntMap a #

deleteMin :: MonoidalIntMap a -> MonoidalIntMap a #

difference :: MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a #

differenceWith :: (a -> b -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a #

differenceWithKey :: (Int -> a -> b -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap a #

empty :: MonoidalIntMap a #

filter :: (a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a #

filterWithKey :: (Int -> a -> Bool) -> MonoidalIntMap a -> MonoidalIntMap a #

findMax :: MonoidalIntMap a -> (Int, a) #

findMin :: MonoidalIntMap a -> (Int, a) #

foldMapWithKey :: forall a m. Monoid m => (Int -> a -> m) -> MonoidalIntMap a -> m #

foldl :: (a -> b -> a) -> a -> MonoidalIntMap b -> a #

foldl' :: (a -> b -> a) -> a -> MonoidalIntMap b -> a #

foldlWithKey :: (a -> Int -> b -> a) -> a -> MonoidalIntMap b -> a #

foldlWithKey' :: (a -> Int -> b -> a) -> a -> MonoidalIntMap b -> a #

foldr :: (a -> b -> b) -> b -> MonoidalIntMap a -> b #

foldr' :: (a -> b -> b) -> b -> MonoidalIntMap a -> b #

foldrWithKey :: (Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b #

foldrWithKey' :: (Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b #

fromAscList :: [(Int, a)] -> MonoidalIntMap a #

fromAscListWith :: (a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a #

fromAscListWithKey :: (Int -> a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a #

fromDistinctAscList :: [(Int, a)] -> MonoidalIntMap a #

fromDistinctList :: [(Int, a)] -> MonoidalIntMap a #

fromList :: [(Int, a)] -> MonoidalIntMap a #

fromListWith :: (a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a #

fromListWithKey :: (Int -> a -> a -> a) -> [(Int, a)] -> MonoidalIntMap a #

fromSet :: (Int -> a) -> IntSet -> MonoidalIntMap a #

insert :: Int -> a -> MonoidalIntMap a -> MonoidalIntMap a #

insertLookupWithKey :: (Int -> a -> a -> a) -> Int -> a -> MonoidalIntMap a -> (Maybe a, MonoidalIntMap a) #

insertWith :: (a -> a -> a) -> Int -> a -> MonoidalIntMap a -> MonoidalIntMap a #

insertWithKey :: (Int -> a -> a -> a) -> Int -> a -> MonoidalIntMap a -> MonoidalIntMap a #

intersectionWith :: (a -> b -> c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c #

intersectionWithKey :: (Int -> a -> b -> c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c #

isProperSubmapOf :: Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool #

isProperSubmapOfBy :: (a -> b -> Bool) -> MonoidalIntMap a -> MonoidalIntMap b -> Bool #

isSubmapOf :: Eq a => MonoidalIntMap a -> MonoidalIntMap a -> Bool #

isSubmapOfBy :: (a -> b -> Bool) -> MonoidalIntMap a -> MonoidalIntMap b -> Bool #

keysSet :: MonoidalIntMap a -> IntSet #

lookup :: Int -> MonoidalIntMap a -> Maybe a #

lookupGE :: Int -> MonoidalIntMap a -> Maybe (Int, a) #

lookupGT :: Int -> MonoidalIntMap a -> Maybe (Int, a) #

lookupLE :: Int -> MonoidalIntMap a -> Maybe (Int, a) #

lookupLT :: Int -> MonoidalIntMap a -> Maybe (Int, a) #

map :: (a -> b) -> MonoidalIntMap a -> MonoidalIntMap b #

mapAccum :: (a -> b -> (a, c)) -> a -> MonoidalIntMap b -> (a, MonoidalIntMap c) #

mapAccumRWithKey :: (a -> Int -> b -> (a, c)) -> a -> MonoidalIntMap b -> (a, MonoidalIntMap c) #

mapAccumWithKey :: (a -> Int -> b -> (a, c)) -> a -> MonoidalIntMap b -> (a, MonoidalIntMap c) #

mapEither :: (a -> Either b c) -> MonoidalIntMap a -> (MonoidalIntMap b, MonoidalIntMap c) #

mapEitherWithKey :: (Int -> a -> Either b c) -> MonoidalIntMap a -> (MonoidalIntMap b, MonoidalIntMap c) #

mapKeys :: (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a #

mapKeysMonotonic :: (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a #

mapKeysWith :: (a -> a -> a) -> (Int -> Int) -> MonoidalIntMap a -> MonoidalIntMap a #

mapMaybe :: (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b #

mapMaybeWithKey :: (Int -> a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap b #

mapWithKey :: (Int -> a -> b) -> MonoidalIntMap a -> MonoidalIntMap b #

maxView :: MonoidalIntMap a -> Maybe (a, MonoidalIntMap a) #

maxViewWithKey :: MonoidalIntMap a -> Maybe ((Int, a), MonoidalIntMap a) #

mergeWithKey :: (Int -> a -> b -> Maybe c) -> (MonoidalIntMap a -> MonoidalIntMap c) -> (MonoidalIntMap b -> MonoidalIntMap c) -> MonoidalIntMap a -> MonoidalIntMap b -> MonoidalIntMap c #

minView :: MonoidalIntMap a -> Maybe (a, MonoidalIntMap a) #

minViewWithKey :: MonoidalIntMap a -> Maybe ((Int, a), MonoidalIntMap a) #

null :: MonoidalIntMap a -> Bool #

partition :: (a -> Bool) -> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a) #

partitionWithKey :: (Int -> a -> Bool) -> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a) #

split :: Int -> MonoidalIntMap a -> (MonoidalIntMap a, MonoidalIntMap a) #

splitLookup :: Int -> MonoidalIntMap a -> (MonoidalIntMap a, Maybe a, MonoidalIntMap a) #

splitRoot :: MonoidalIntMap a -> [MonoidalIntMap a] #

toAscList :: MonoidalIntMap a -> [(Int, a)] #

toDescList :: MonoidalIntMap a -> [(Int, a)] #

toList :: MonoidalIntMap a -> [(Int, a)] #

traverseWithKey :: Applicative t => (Int -> a -> t b) -> MonoidalIntMap a -> t (MonoidalIntMap b) #

unionWith :: (a -> a -> a) -> MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a #

unionWithKey :: (Int -> a -> a -> a) -> MonoidalIntMap a -> MonoidalIntMap a -> MonoidalIntMap a #

unionsWith :: (a -> a -> a) -> [MonoidalIntMap a] -> MonoidalIntMap a #

update :: (a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a #

updateLookupWithKey :: (Int -> a -> Maybe a) -> Int -> MonoidalIntMap a -> (Maybe a, MonoidalIntMap a) #

updateMax :: (a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a #

updateMaxWithKey :: (Int -> a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a #

updateMin :: (a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a #

updateMinWithKey :: (Int -> a -> Maybe a) -> MonoidalIntMap a -> MonoidalIntMap a #

updateWithKey :: (Int -> a -> Maybe a) -> Int -> MonoidalIntMap a -> MonoidalIntMap a #