monoidal-containers-0.6.3.0: Containers with monoidal accumulation
Safe Haskell None
Language Haskell2010

Data.IntMap.Monoidal

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

Documentation

newtype MonoidalIntMap a Source #

An IntMap with monoidal accumulation

Instances

Instances details
Functor MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Foldable MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Traversable MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

ToJSON1 MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

FromJSON1 MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Eq1 MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Ord1 MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Show1 MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Semialign MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Align MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Unalign MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Zip MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Filterable MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Witherable MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

FunctorWithIndex Int MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

FoldableWithIndex Int MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Methods

ifoldMap :: Monoid m => ( Int -> a -> m) -> MonoidalIntMap a -> m Source #

ifoldMap' :: Monoid m => ( Int -> a -> m) -> MonoidalIntMap a -> m Source #

ifoldr :: ( Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b Source #

ifoldl :: ( Int -> b -> a -> b) -> b -> MonoidalIntMap a -> b Source #

ifoldr' :: ( Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b Source #

ifoldl' :: ( Int -> b -> a -> b) -> b -> MonoidalIntMap a -> b Source #

TraversableWithIndex Int MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

TraverseMin Int MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

TraverseMax Int MonoidalIntMap Source #
Instance details

Defined in Data.IntMap.Monoidal

Semigroup a => IsList ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Associated Types

type Item ( MonoidalIntMap a) Source #

Eq a => Eq ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Data a => Data ( MonoidalIntMap a) Source #
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) Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c ( MonoidalIntMap a) Source #

toConstr :: MonoidalIntMap a -> Constr Source #

dataTypeOf :: MonoidalIntMap a -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c ( MonoidalIntMap a)) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c ( MonoidalIntMap a)) Source #

gmapT :: ( forall b. Data b => b -> b) -> MonoidalIntMap a -> MonoidalIntMap a Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> MonoidalIntMap a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> MonoidalIntMap a -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> MonoidalIntMap a -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> MonoidalIntMap a -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> MonoidalIntMap a -> m ( MonoidalIntMap a) Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> MonoidalIntMap a -> m ( MonoidalIntMap a) Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> MonoidalIntMap a -> m ( MonoidalIntMap a) Source #

Ord a => Ord ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Read a => Read ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Show a => Show ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Semigroup a => Semigroup ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Semigroup a => Monoid ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

ToJSON a => ToJSON ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

FromJSON a => FromJSON ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

NFData a => NFData ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Ixed ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

At ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Wrapped ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

AsEmpty ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Newtype ( MonoidalIntMap a) ( IntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Each ( MonoidalIntMap a) ( MonoidalIntMap b) a b Source #
Instance details

Defined in Data.IntMap.Monoidal

type Item ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

type Index ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

type IxValue ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

type Unwrapped ( MonoidalIntMap a) Source #
Instance details

Defined in Data.IntMap.Monoidal

Often-needed functions

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

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

size :: MonoidalIntMap a -> Int Source #

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

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

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

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

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

findWithDefault :: forall a. a -> Int -> MonoidalIntMap a -> a Source #

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)] Source #

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

elems :: MonoidalIntMap a -> [a] Source #

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

keys :: MonoidalIntMap a -> [ Int ] Source #

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

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

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

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.

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

foldl :: forall a b. (a -> b -> a) -> a -> MonoidalIntMap b -> a Source #

foldl' :: forall a b. (a -> b -> a) -> a -> MonoidalIntMap b -> a Source #

foldlWithKey :: forall a b. (a -> Int -> b -> a) -> a -> MonoidalIntMap b -> a Source #

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

foldr :: forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b Source #

foldr' :: forall a b. (a -> b -> b) -> b -> MonoidalIntMap a -> b Source #

foldrWithKey :: forall a b. ( Int -> a -> b -> b) -> b -> MonoidalIntMap a -> b Source #

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

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

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

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

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

insertWith :: forall a. (a -> a -> a) -> Int -> a -> MonoidalIntMap a -> MonoidalIntMap a Source #

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

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

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