monoidal-containers-0.6.5.0: Containers with monoidal accumulation

Safe Haskell | None
Language | Haskell2010

Data.Map.Monoidal

Contents

- Often-needed functions

Description

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

While some functions mirroring those of `Map` 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 MonoidalMap k a = MonoidalMap {
  - getMonoidalMap :: Map k a
  }
- singleton :: k -> a -> MonoidalMap k a
- size :: MonoidalMap k a -> Int
- member :: Ord k => k -> MonoidalMap k a -> Bool
- notMember :: Ord k => k -> MonoidalMap k a -> Bool
- findWithDefault :: Ord k => a -> k -> MonoidalMap k a -> a
- assocs :: MonoidalMap k a -> [(k, a)]
- elems :: MonoidalMap k a -> [a]
- keys :: MonoidalMap k a -> [k]
- (!?) :: Ord k => MonoidalMap k a -> k -> Maybe a
- (!) :: Ord k => MonoidalMap k a -> k -> a
- (\\) :: Ord k => MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
- adjust :: Ord k => (a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
- adjustWithKey :: Ord k => (k -> a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
- alter :: Ord k => (Maybe a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
- delete :: Ord k => k -> MonoidalMap k a -> MonoidalMap k a
- deleteAt :: Int -> MonoidalMap k a -> MonoidalMap k a
- take :: Int -> MonoidalMap k a -> MonoidalMap k a
- drop :: Int -> MonoidalMap k a -> MonoidalMap k a
- splitAt :: Int -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
- lookupMin :: MonoidalMap k a -> Maybe (k, a)
- lookupMax :: MonoidalMap k a -> Maybe (k, a)
- deleteFindMax :: MonoidalMap k a -> ((k, a), MonoidalMap k a)
- deleteFindMin :: MonoidalMap k a -> ((k, a), MonoidalMap k a)
- deleteMax :: MonoidalMap k a -> MonoidalMap k a
- deleteMin :: MonoidalMap k a -> MonoidalMap k a
- difference :: Ord k => MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
- differenceWith :: Ord k => (a -> b -> Maybe a) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
- differenceWithKey :: Ord k => (k -> a -> b -> Maybe a) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
- elemAt :: Int -> MonoidalMap k a -> (k, a)
- empty :: MonoidalMap k a
- filter :: forall k a. (a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
- filterWithKey :: (k -> a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
- restrictKeys :: Ord k => MonoidalMap k a -> Set k -> MonoidalMap k a
- withoutKeys :: Ord k => MonoidalMap k a -> Set k -> MonoidalMap k a
- findIndex :: Ord k => k -> MonoidalMap k a -> Int
- findMax :: MonoidalMap k a -> (k, a)
- findMin :: MonoidalMap k a -> (k, a)
- foldMapWithKey :: forall k a m. Monoid m => (k -> a -> m) -> MonoidalMap k a -> m
- foldl :: forall k a b. (a -> b -> a) -> a -> MonoidalMap k b -> a
- foldl' :: forall k a b. (a -> b -> a) -> a -> MonoidalMap k b -> a
- foldlWithKey :: forall k a b. (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
- foldlWithKey' :: forall k a b. (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
- foldr :: forall k a b. (a -> b -> b) -> b -> MonoidalMap k a -> b
- foldr' :: forall k a b. (a -> b -> b) -> b -> MonoidalMap k a -> b
- foldrWithKey :: (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
- foldrWithKey' :: (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
- fromAscList :: Eq k => [(k, a)] -> MonoidalMap k a
- fromAscListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
- fromAscListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
- fromDistinctAscList :: [(k, a)] -> MonoidalMap k a
- fromDistinctList :: Ord k => [(k, a)] -> MonoidalMap k a
- fromDescList :: Eq k => [(k, a)] -> MonoidalMap k a
- fromDescListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
- fromDescListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
- fromDistinctDescList :: [(k, a)] -> MonoidalMap k a
- fromList :: Ord k => [(k, a)] -> MonoidalMap k a
- fromListWith :: Ord k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
- fromListWithKey :: Ord k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
- fromSet :: (k -> a) -> Set k -> MonoidalMap k a
- insert :: Ord k => k -> a -> MonoidalMap k a -> MonoidalMap k a
- insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> (Maybe a, MonoidalMap k a)
- insertWith :: Ord k => (a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
- insertWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
- intersectionWith :: Ord k => (a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
- intersectionWithKey :: Ord k => (k -> a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
- isProperSubmapOf :: (Ord k, Eq a) => MonoidalMap k a -> MonoidalMap k a -> Bool
- isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
- isSubmapOf :: (Ord k, Eq a) => MonoidalMap k a -> MonoidalMap k a -> Bool
- isSubmapOfBy :: Ord k => (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
- keysSet :: MonoidalMap k a -> Set k
- lookup :: Ord k => k -> MonoidalMap k a -> Maybe a
- lookupGE :: Ord k => k -> MonoidalMap k a -> Maybe (k, a)
- lookupGT :: Ord k => k -> MonoidalMap k a -> Maybe (k, a)
- lookupIndex :: Ord k => k -> MonoidalMap k a -> Maybe Int
- lookupLE :: Ord k => k -> MonoidalMap k a -> Maybe (k, a)
- lookupLT :: Ord k => k -> MonoidalMap k a -> Maybe (k, a)
- map :: (a -> b) -> MonoidalMap k a -> MonoidalMap k b
- mapAccum :: forall k a b c. (a -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
- mapAccumRWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
- mapAccumWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
- mapEither :: forall k a b c. (a -> Either b c) -> MonoidalMap k a -> (MonoidalMap k b, MonoidalMap k c)
- mapEitherWithKey :: (k -> a -> Either b c) -> MonoidalMap k a -> (MonoidalMap k b, MonoidalMap k c)
- mapKeys :: forall k1 k2 a. Ord k2 => (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
- mapKeysMonotonic :: (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
- mapKeysWith :: forall k1 k2 a. Ord k2 => (a -> a -> a) -> (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
- mapMaybe :: forall k a b. (a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
- mapMaybeWithKey :: (k -> a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
- mapWithKey :: (k -> a -> b) -> MonoidalMap k a -> MonoidalMap k b
- maxView :: MonoidalMap k a -> Maybe (a, MonoidalMap k a)
- maxViewWithKey :: MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
- mergeWithKey :: Ord k => (k -> a -> b -> Maybe c) -> (MonoidalMap k a -> MonoidalMap k c) -> (MonoidalMap k b -> MonoidalMap k c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
- minView :: MonoidalMap k a -> Maybe (a, MonoidalMap k a)
- minViewWithKey :: MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
- null :: MonoidalMap k a -> Bool
- partition :: forall k a. (a -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
- partitionWithKey :: (k -> a -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
- takeWhileAntitone :: (k -> Bool) -> MonoidalMap k a -> MonoidalMap k a
- dropWhileAntitone :: (k -> Bool) -> MonoidalMap k a -> MonoidalMap k a
- spanAntitone :: (k -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
- split :: Ord k => k -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
- splitLookup :: Ord k => k -> MonoidalMap k a -> (MonoidalMap k a, Maybe a, MonoidalMap k a)
- splitRoot :: MonoidalMap k a -> [MonoidalMap k a]
- toAscList :: MonoidalMap k a -> [(k, a)]
- toDescList :: MonoidalMap k a -> [(k, a)]
- toList :: MonoidalMap k a -> [(k, a)]
- traverseWithKey :: Applicative t => (k -> a -> t b) -> MonoidalMap k a -> t (MonoidalMap k b)
- traverseMaybeWithKey :: Applicative f => (k -> a -> f (Maybe b)) -> MonoidalMap k a -> f (MonoidalMap k b)
- unionWith :: Ord k => (a -> a -> a) -> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
- unionWithKey :: Ord k => (k -> a -> a -> a) -> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
- unionsWith :: Ord k => (a -> a -> a) -> [MonoidalMap k a] -> MonoidalMap k a
- update :: Ord k => (a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
- updateAt :: (k -> a -> Maybe a) -> Int -> MonoidalMap k a -> MonoidalMap k a
- updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> MonoidalMap k a -> (Maybe a, MonoidalMap k a)
- updateMax :: forall k a. (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
- updateMaxWithKey :: (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
- updateMin :: forall k a. (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
- updateMinWithKey :: (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
- updateWithKey :: Ord k => (k -> a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
- valid :: Ord k => MonoidalMap k a -> Bool

# Documentation

newtype MonoidalMap k a #

A `Map` with monoidal accumulation

Constructors

MonoidalMap |

Fields

- getMonoidalMap :: Map k a

#### Instances

Instances details

FoldableWithIndex k (MonoidalMap k) # |

Instance details

Defined in Data.Map.Monoidal

Methods

ifoldMap :: Monoid m => (k -> a -> m) -> MonoidalMap k a -> m #

ifoldMap' :: Monoid m => (k -> a -> m) -> MonoidalMap k a -> m #

ifoldr :: (k -> a -> b -> b) -> b -> MonoidalMap k a -> b #

ifoldl :: (k -> b -> a -> b) -> b -> MonoidalMap k a -> b #

ifoldr' :: (k -> a -> b -> b) -> b -> MonoidalMap k a -> b #

ifoldl' :: (k -> b -> a -> b) -> b -> MonoidalMap k a -> b #

FunctorWithIndex k (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods imap :: (k -> a -> b) -> MonoidalMap k a -> MonoidalMap k b #
TraversableWithIndex k (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods itraverse :: Applicative f => (k -> a -> f b) -> MonoidalMap k a -> f (MonoidalMap k b) #
Ord k => TraverseMax k (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods traverseMax :: IndexedTraversal' k (MonoidalMap k v) v #
Ord k => TraverseMin k (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods traverseMin :: IndexedTraversal' k (MonoidalMap k v) v #
(FromJSONKey k, Ord k) => FromJSON1 (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (MonoidalMap k a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [MonoidalMap k a] # liftOmittedField :: Maybe a -> Maybe (MonoidalMap k a) #
ToJSONKey k => ToJSON1 (MonoidalMap k) # |

Instance details

Defined in Data.Map.Monoidal

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> MonoidalMap k a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [MonoidalMap k a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> MonoidalMap k a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [MonoidalMap k a] -> Encoding #

liftOmitField :: (a -> Bool) -> MonoidalMap k a -> Bool #

Ord k => Eq1 (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods liftEq :: (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool #
Ord k => Ord1 (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods liftCompare :: (a -> b -> Ordering) -> MonoidalMap k a -> MonoidalMap k b -> Ordering #
Show k => Show1 (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> MonoidalMap k a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [MonoidalMap k a] -> ShowS #
Functor (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods fmap :: (a -> b) -> MonoidalMap k a -> MonoidalMap k b # (<$) :: a -> MonoidalMap k b -> MonoidalMap k a #
Foldable (MonoidalMap k) # |

Instance details

Defined in Data.Map.Monoidal

Methods

fold :: Monoid m => MonoidalMap k m -> m #

foldMap :: Monoid m => (a -> m) -> MonoidalMap k a -> m #

foldMap' :: Monoid m => (a -> m) -> MonoidalMap k a -> m #

foldr :: (a -> b -> b) -> b -> MonoidalMap k a -> b #

foldr' :: (a -> b -> b) -> b -> MonoidalMap k a -> b #

foldl :: (b -> a -> b) -> b -> MonoidalMap k a -> b #

foldl' :: (b -> a -> b) -> b -> MonoidalMap k a -> b #

foldr1 :: (a -> a -> a) -> MonoidalMap k a -> a #

foldl1 :: (a -> a -> a) -> MonoidalMap k a -> a #

toList :: MonoidalMap k a -> [a] #

null :: MonoidalMap k a -> Bool #

length :: MonoidalMap k a -> Int #

elem :: Eq a => a -> MonoidalMap k a -> Bool #

maximum :: Ord a => MonoidalMap k a -> a #

minimum :: Ord a => MonoidalMap k a -> a #

sum :: Num a => MonoidalMap k a -> a #

product :: Num a => MonoidalMap k a -> a #

Traversable (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods traverse :: Applicative f => (a -> f b) -> MonoidalMap k a -> f (MonoidalMap k b) # sequenceA :: Applicative f => MonoidalMap k (f a) -> f (MonoidalMap k a) # mapM :: Monad m => (a -> m b) -> MonoidalMap k a -> m (MonoidalMap k b) # sequence :: Monad m => MonoidalMap k (m a) -> m (MonoidalMap k a) #
Ord k => Align (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods nil :: MonoidalMap k a #
Ord k => Semialign (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods align :: MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k (These a b) # alignWith :: (These a b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c #
Ord k => Unalign (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods unalign :: MonoidalMap k (These a b) -> (MonoidalMap k a, MonoidalMap k b) # unalignWith :: (c -> These a b) -> MonoidalMap k c -> (MonoidalMap k a, MonoidalMap k b) #
Ord k => Zip (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods zip :: MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k (a, b) # zipWith :: (a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c #
Filterable (MonoidalMap k) # |
Instance details Defined in Data.Map.Monoidal Methods mapMaybe :: (a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b # catMaybes :: MonoidalMap k (Maybe a) -> MonoidalMap k a # filter :: (a -> Bool) -> MonoidalMap k a -> MonoidalMap k a # drain :: MonoidalMap k a -> MonoidalMap k b #
Ord k => Witherable (MonoidalMap k) # |

Instance details

Defined in Data.Map.Monoidal

Methods

wither :: Applicative f => (a -> f (Maybe b)) -> MonoidalMap k a -> f (MonoidalMap k b) #

witherM :: Monad m => (a -> m (Maybe b)) -> MonoidalMap k a -> m (MonoidalMap k b) #

filterA :: Applicative f => (a -> f Bool) -> MonoidalMap k a -> f (MonoidalMap k a) #

witherMap :: Applicative m => (MonoidalMap k b -> r) -> (a -> m (Maybe b)) -> MonoidalMap k a -> m r #

(FromJSONKey k, Ord k, FromJSON a) => FromJSON (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods parseJSON :: Value -> Parser (MonoidalMap k a) # parseJSONList :: Value -> Parser [MonoidalMap k a] # omittedField :: Maybe (MonoidalMap k a) #
(ToJSON a, ToJSONKey k) => ToJSON (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods toJSON :: MonoidalMap k a -> Value # toEncoding :: MonoidalMap k a -> Encoding # toJSONList :: [MonoidalMap k a] -> Value # toEncodingList :: [MonoidalMap k a] -> Encoding # omitField :: MonoidalMap k a -> Bool #
(NFData k, NFData a) => NFData (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods rnf :: MonoidalMap k a -> () #
(Ord k, Semigroup a) => Monoid (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods mempty :: MonoidalMap k a # mappend :: MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a # mconcat :: [MonoidalMap k a] -> MonoidalMap k a #
(Ord k, Semigroup a) => Semigroup (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods (<>) :: MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a # sconcat :: NonEmpty (MonoidalMap k a) -> MonoidalMap k a # stimes :: Integral b => b -> MonoidalMap k a -> MonoidalMap k a #
(Data k, Data a, Ord k) => Data (MonoidalMap k a) # |

Instance details

Defined in Data.Map.Monoidal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MonoidalMap k a -> c (MonoidalMap k a) #

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

toConstr :: MonoidalMap k a -> Constr #

dataTypeOf :: MonoidalMap k a -> DataType #

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

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

gmapT :: (forall b. Data b => b -> b) -> MonoidalMap k a -> MonoidalMap k a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MonoidalMap k a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MonoidalMap k a -> r #

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

gmapQi :: Int -> (forall d. Data d => d -> u) -> MonoidalMap k a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> MonoidalMap k a -> m (MonoidalMap k a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MonoidalMap k a -> m (MonoidalMap k a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MonoidalMap k a -> m (MonoidalMap k a) #

(Ord k, Semigroup a) => IsList (MonoidalMap k a) # |

Instance details

Defined in Data.Map.Monoidal

Associated Types

type Item (MonoidalMap k a) |
Instance details Defined in Data.Map.Monoidal type Item (MonoidalMap k a) = (k, a)

Methods

fromList :: [Item (MonoidalMap k a)] -> MonoidalMap k a #

fromListN :: Int -> [Item (MonoidalMap k a)] -> MonoidalMap k a #

toList :: MonoidalMap k a -> [Item (MonoidalMap k a)] #

(Ord k, Read k, Read a) => Read (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods readsPrec :: Int -> ReadS (MonoidalMap k a) # readList :: ReadS [MonoidalMap k a] # readPrec :: ReadPrec (MonoidalMap k a) # readListPrec :: ReadPrec [MonoidalMap k a] #
(Show k, Show a) => Show (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods showsPrec :: Int -> MonoidalMap k a -> ShowS # show :: MonoidalMap k a -> String # showList :: [MonoidalMap k a] -> ShowS #
(Eq k, Eq a) => Eq (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods (==) :: MonoidalMap k a -> MonoidalMap k a -> Bool # (/=) :: MonoidalMap k a -> MonoidalMap k a -> Bool #
(Ord k, Ord a) => Ord (MonoidalMap k a) # |

Instance details

Defined in Data.Map.Monoidal

Methods

compare :: MonoidalMap k a -> MonoidalMap k a -> Ordering #

(<) :: MonoidalMap k a -> MonoidalMap k a -> Bool #

(<=) :: MonoidalMap k a -> MonoidalMap k a -> Bool #

(>) :: MonoidalMap k a -> MonoidalMap k a -> Bool #

(>=) :: MonoidalMap k a -> MonoidalMap k a -> Bool #

max :: MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a #

min :: MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a #

Ord k => At (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods at :: Index (MonoidalMap k a) -> Lens' (MonoidalMap k a) (Maybe (IxValue (MonoidalMap k a))) #
Ord k => Ixed (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods ix :: Index (MonoidalMap k a) -> Traversal' (MonoidalMap k a) (IxValue (MonoidalMap k a)) #
AsEmpty (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal Methods _Empty :: Prism' (MonoidalMap k a) () #
Wrapped (MonoidalMap k a) # |

Instance details

Defined in Data.Map.Monoidal

Associated Types

type Unwrapped (MonoidalMap k a) |
Instance details Defined in Data.Map.Monoidal type Unwrapped (MonoidalMap k a) = Map k a

Methods

_Wrapped' :: Iso' (MonoidalMap k a) (Unwrapped (MonoidalMap k a)) #

Ord k => Rewrapped (Map k a) (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal
Ord k => Rewrapped (MonoidalMap k a) (Map k a) # |
Instance details Defined in Data.Map.Monoidal
Newtype (MonoidalMap k a) (Map k a) # |
Instance details Defined in Data.Map.Monoidal Methods pack :: Map k a -> MonoidalMap k a # unpack :: MonoidalMap k a -> Map k a #
Each (MonoidalMap k a) (MonoidalMap k b) a b # |
Instance details Defined in Data.Map.Monoidal Methods each :: Traversal (MonoidalMap k a) (MonoidalMap k b) a b #
type Item (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal type Item (MonoidalMap k a) = (k, a)
type Index (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal type Index (MonoidalMap k a) = k
type IxValue (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal type IxValue (MonoidalMap k a) = a
type Unwrapped (MonoidalMap k a) # |
Instance details Defined in Data.Map.Monoidal type Unwrapped (MonoidalMap k a) = Map k a

# Often-needed functions

singleton :: k -> a -> MonoidalMap k a #

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

size :: MonoidalMap k a -> Int #

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

member :: Ord k => k -> MonoidalMap k a -> Bool #

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

notMember :: Ord k => k -> MonoidalMap k a -> Bool #

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

findWithDefault :: Ord k => a -> k -> MonoidalMap k 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 :: MonoidalMap k a -> [(k, a)] #

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

elems :: MonoidalMap k a -> [a] #

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

keys :: MonoidalMap k a -> [k] #

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

(!?) :: Ord k => MonoidalMap k a -> k -> Maybe a infixl 9 #

(!) :: Ord k => MonoidalMap k a -> k -> a infixl 9 #

(\\) :: Ord k => MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a infixl 9 #

adjust :: Ord k => (a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a #

adjustWithKey :: Ord k => (k -> a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a #

alter :: Ord k => (Maybe a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a #

delete :: Ord k => k -> MonoidalMap k a -> MonoidalMap k 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.

deleteAt :: Int -> MonoidalMap k a -> MonoidalMap k a #

take :: Int -> MonoidalMap k a -> MonoidalMap k a #

drop :: Int -> MonoidalMap k a -> MonoidalMap k a #

splitAt :: Int -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a) #

lookupMin :: MonoidalMap k a -> Maybe (k, a) #

lookupMax :: MonoidalMap k a -> Maybe (k, a) #

deleteFindMax :: MonoidalMap k a -> ((k, a), MonoidalMap k a) #

deleteFindMin :: MonoidalMap k a -> ((k, a), MonoidalMap k a) #

deleteMax :: MonoidalMap k a -> MonoidalMap k a #

deleteMin :: MonoidalMap k a -> MonoidalMap k a #

difference :: Ord k => MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a #

differenceWith :: Ord k => (a -> b -> Maybe a) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a #

differenceWithKey :: Ord k => (k -> a -> b -> Maybe a) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a #

elemAt :: Int -> MonoidalMap k a -> (k, a) #

empty :: MonoidalMap k a #

filter :: forall k a. (a -> Bool) -> MonoidalMap k a -> MonoidalMap k a #

filterWithKey :: (k -> a -> Bool) -> MonoidalMap k a -> MonoidalMap k a #

restrictKeys :: Ord k => MonoidalMap k a -> Set k -> MonoidalMap k a #

withoutKeys :: Ord k => MonoidalMap k a -> Set k -> MonoidalMap k a #

findIndex :: Ord k => k -> MonoidalMap k a -> Int #

findMax :: MonoidalMap k a -> (k, a) #

findMin :: MonoidalMap k a -> (k, a) #

foldMapWithKey :: forall k a m. Monoid m => (k -> a -> m) -> MonoidalMap k a -> m #

foldl :: forall k a b. (a -> b -> a) -> a -> MonoidalMap k b -> a #

foldl' :: forall k a b. (a -> b -> a) -> a -> MonoidalMap k b -> a #

foldlWithKey :: forall k a b. (a -> k -> b -> a) -> a -> MonoidalMap k b -> a #

foldlWithKey' :: forall k a b. (a -> k -> b -> a) -> a -> MonoidalMap k b -> a #

foldr :: forall k a b. (a -> b -> b) -> b -> MonoidalMap k a -> b #

foldr' :: forall k a b. (a -> b -> b) -> b -> MonoidalMap k a -> b #

foldrWithKey :: (k -> a -> b -> b) -> b -> MonoidalMap k a -> b #

foldrWithKey' :: (k -> a -> b -> b) -> b -> MonoidalMap k a -> b #

fromAscList :: Eq k => [(k, a)] -> MonoidalMap k a #

fromAscListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a #

fromAscListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a #

fromDistinctAscList :: [(k, a)] -> MonoidalMap k a #

fromDistinctList :: Ord k => [(k, a)] -> MonoidalMap k a #

fromDescList :: Eq k => [(k, a)] -> MonoidalMap k a #

fromDescListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a #

fromDescListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a #

fromDistinctDescList :: [(k, a)] -> MonoidalMap k a #

fromList :: Ord k => [(k, a)] -> MonoidalMap k a #

fromListWith :: Ord k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a #

fromListWithKey :: Ord k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a #

fromSet :: (k -> a) -> Set k -> MonoidalMap k a #

insert :: Ord k => k -> a -> MonoidalMap k a -> MonoidalMap k a #

insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> (Maybe a, MonoidalMap k a) #

insertWith :: Ord k => (a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a #

insertWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a #

intersectionWith :: Ord k => (a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c #

intersectionWithKey :: Ord k => (k -> a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c #

isProperSubmapOf :: (Ord k, Eq a) => MonoidalMap k a -> MonoidalMap k a -> Bool #

isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool #

isSubmapOf :: (Ord k, Eq a) => MonoidalMap k a -> MonoidalMap k a -> Bool #

isSubmapOfBy :: Ord k => (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool #

keysSet :: MonoidalMap k a -> Set k #

lookup :: Ord k => k -> MonoidalMap k a -> Maybe a #

lookupGE :: Ord k => k -> MonoidalMap k a -> Maybe (k, a) #

lookupGT :: Ord k => k -> MonoidalMap k a -> Maybe (k, a) #

lookupIndex :: Ord k => k -> MonoidalMap k a -> Maybe Int #

lookupLE :: Ord k => k -> MonoidalMap k a -> Maybe (k, a) #

lookupLT :: Ord k => k -> MonoidalMap k a -> Maybe (k, a) #

map :: (a -> b) -> MonoidalMap k a -> MonoidalMap k b #

mapAccum :: forall k a b c. (a -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c) #

mapAccumRWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c) #

mapAccumWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c) #

mapEither :: forall k a b c. (a -> Either b c) -> MonoidalMap k a -> (MonoidalMap k b, MonoidalMap k c) #

mapEitherWithKey :: (k -> a -> Either b c) -> MonoidalMap k a -> (MonoidalMap k b, MonoidalMap k c) #

mapKeys :: forall k1 k2 a. Ord k2 => (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a #

mapKeysMonotonic :: (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a #

O(n). ``mapKeysMonotonic` f s == `mapKeys` f s`, but works only when `f` is strictly increasing (both monotonic and injective). That is, for any values `x` and `y`, if `x` < `y` then `f x` < `f y` and `f` is injective (i.e. it never maps two input keys to the same output key). The precondition is not checked. Semi-formally, we have:

    and [x < y ==> f x < f y | x <- ls, y <- ls]
                        ==> mapKeysMonotonic f s == mapKeys f s
        where ls = keys s

This means that `f` maps distinct original keys to distinct resulting keys. This function has better performance than `mapKeys`.

    mapKeysMonotonic (\ k -> k * 2) (fromList [(5,"a"), (3,"b")]) == fromList [(6, "b"), (10, "a")]
    valid (mapKeysMonotonic (\ k -> k * 2) (fromList [(5,"a"), (3,"b")])) == True
    valid (mapKeysMonotonic (\ _ -> 1)     (fromList [(5,"a"), (3,"b")])) == False

mapKeysWith :: forall k1 k2 a. Ord k2 => (a -> a -> a) -> (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a #

mapMaybe :: forall k a b. (a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b #

mapMaybeWithKey :: (k -> a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b #

mapWithKey :: (k -> a -> b) -> MonoidalMap k a -> MonoidalMap k b #

maxView :: MonoidalMap k a -> Maybe (a, MonoidalMap k a) #

maxViewWithKey :: MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a) #

mergeWithKey :: Ord k => (k -> a -> b -> Maybe c) -> (MonoidalMap k a -> MonoidalMap k c) -> (MonoidalMap k b -> MonoidalMap k c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c #

minView :: MonoidalMap k a -> Maybe (a, MonoidalMap k a) #

minViewWithKey :: MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a) #

null :: MonoidalMap k a -> Bool #

partition :: forall k a. (a -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a) #

partitionWithKey :: (k -> a -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a) #

takeWhileAntitone :: (k -> Bool) -> MonoidalMap k a -> MonoidalMap k a #

dropWhileAntitone :: (k -> Bool) -> MonoidalMap k a -> MonoidalMap k a #

spanAntitone :: (k -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a) #

split :: Ord k => k -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a) #

splitLookup :: Ord k => k -> MonoidalMap k a -> (MonoidalMap k a, Maybe a, MonoidalMap k a) #

splitRoot :: MonoidalMap k a -> [MonoidalMap k a] #

toAscList :: MonoidalMap k a -> [(k, a)] #

toDescList :: MonoidalMap k a -> [(k, a)] #

toList :: MonoidalMap k a -> [(k, a)] #

traverseWithKey :: Applicative t => (k -> a -> t b) -> MonoidalMap k a -> t (MonoidalMap k b) #

traverseMaybeWithKey :: Applicative f => (k -> a -> f (Maybe b)) -> MonoidalMap k a -> f (MonoidalMap k b) #

unionWith :: Ord k => (a -> a -> a) -> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a #

unionWithKey :: Ord k => (k -> a -> a -> a) -> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a #

unionsWith :: Ord k => (a -> a -> a) -> [MonoidalMap k a] -> MonoidalMap k a #

update :: Ord k => (a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a #

updateAt :: (k -> a -> Maybe a) -> Int -> MonoidalMap k a -> MonoidalMap k a #

updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> MonoidalMap k a -> (Maybe a, MonoidalMap k a) #

updateMax :: forall k a. (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a #

updateMaxWithKey :: (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a #

updateMin :: forall k a. (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a #

updateMinWithKey :: (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a #

updateWithKey :: Ord k => (k -> a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a #

valid :: Ord k => MonoidalMap k a -> Bool #