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

-- | This module provides a 'Data.Map' variant which uses the value's
-- 'Monoid' instance to accumulate conflicting entries when merging
-- 'Map's.
--
-- While some functions mirroring those of 'Data.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'.

module Data.Map.Monoidal
    ( MonoidalMap(..)
      -- * Often-needed functions
    , singleton
    , size
    , member
    , notMember
    , findWithDefault
    , assocs
    , elems
    , keys
    , (!?)
    , (!)
    , (\\)
    , adjust
    , adjustWithKey
    , alter
    , delete
    , deleteAt
    , take
    , drop
    , splitAt
    , lookupMin
    , lookupMax
    , deleteFindMax
    , deleteFindMin
    , deleteMax
    , deleteMin
    , difference
    , differenceWith
    , differenceWithKey
    , elemAt
    , empty
    , filter
    , filterWithKey
    , restrictKeys
    , withoutKeys
    , findIndex
    , findMax
    , findMin
    , foldMapWithKey
    , foldl
    , foldl'
    , foldlWithKey
    , foldlWithKey'
    , foldr
    , foldr'
    , foldrWithKey
    , foldrWithKey'
    , fromAscList
    , fromAscListWith
    , fromAscListWithKey
    , fromDistinctAscList
    , fromDistinctList
    , fromDescList
    , fromDescListWith
    , fromDescListWithKey
    , fromDistinctDescList
    , 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
    , takeWhileAntitone
    , dropWhileAntitone
    , spanAntitone
    , split
    , splitLookup
    , splitRoot
    , toAscList
    , toDescList
    , toList
    , traverseWithKey
    , traverseMaybeWithKey
    , unionWith
    , unionWithKey
    , unionsWith
    , update
    , updateAt
    , updateLookupWithKey
    , updateMax
    , updateMaxWithKey
    , updateMin
    , updateMinWithKey
    , updateWithKey
    , valid
    -- , showTree
    -- , showTreeWith
    ) where

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

import Data.Coerce (coerce)
import Data.Set (Set)
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.Map 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

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

deriving instance (Ord k) => Eq1 (MonoidalMap k)
deriving instance (Ord k) => Ord1 (MonoidalMap k)
deriving instance (Show k) => Show1 (MonoidalMap k)

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

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

instance Each (MonoidalMap k a) (MonoidalMap k b) a b

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

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

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

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

instance Ord k => Rewrapped (M.Map k a) (MonoidalMap k a)

instance Ord k => Rewrapped (MonoidalMap k a) (M.Map k a)

instance (Ord k, Semigroup a) => Semigroup (MonoidalMap k a) where
    MonoidalMap Map k a
a <> :: MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
<> MonoidalMap Map k a
b = Map k a -> MonoidalMap k a
forall k a. Map k a -> MonoidalMap k a
MonoidalMap (Map k a -> MonoidalMap k a) -> Map k a -> MonoidalMap k a
forall a b. (a -> b) -> a -> b
$ (a -> a -> a) -> Map k a -> Map k a -> Map k a
forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
M.unionWith a -> a -> a
forall a. Semigroup a => a -> a -> a
(<>) Map k a
a Map k a
b
    {-# INLINE (<>) #-}

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

instance Newtype (MonoidalMap k a) (M.Map k a) where
    pack :: Map k a -> MonoidalMap k a
pack = Map k a -> MonoidalMap k a
forall k a. Map k a -> MonoidalMap k a
MonoidalMap
    {-# INLINE pack #-}
    unpack :: MonoidalMap k a -> Map k a
unpack (MonoidalMap Map k a
a) = Map k a
a
    {-# INLINE unpack #-}

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

instance Ord k => Witherable.Witherable (MonoidalMap k)

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

-- | /O(1)/. The number of elements in the map.
size :: MonoidalMap k a -> Int
size :: MonoidalMap k a -> Int
size = Map k a -> Int
forall k a. Map k a -> Int
M.size (Map k a -> Int)
-> (MonoidalMap k a -> Map k a) -> MonoidalMap k a -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MonoidalMap k a -> Map k a
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 :: Ord k => k -> MonoidalMap k a -> Bool
member :: k -> MonoidalMap k a -> Bool
member k
k = k -> Map k a -> Bool
forall k a. Ord k => k -> Map k a -> Bool
M.member k
k (Map k a -> Bool)
-> (MonoidalMap k a -> Map k a) -> MonoidalMap k a -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MonoidalMap k a -> Map k a
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 :: Ord k => k -> MonoidalMap k a -> Bool
notMember :: k -> MonoidalMap k a -> Bool
notMember k
k = Bool -> Bool
not (Bool -> Bool)
-> (MonoidalMap k a -> Bool) -> MonoidalMap k a -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. k -> Map k a -> Bool
forall k a. Ord k => k -> Map k a -> Bool
M.member k
k (Map k a -> Bool)
-> (MonoidalMap k a -> Map k a) -> MonoidalMap k a -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MonoidalMap k a -> Map k a
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 :: Ord k => a -> k -> MonoidalMap k a -> a
findWithDefault :: a -> k -> MonoidalMap k a -> a
findWithDefault a
def k
k = a -> k -> Map k a -> a
forall k a. Ord k => a -> k -> Map k a -> a
M.findWithDefault a
def k
k (Map k a -> a)
-> (MonoidalMap k a -> Map k a) -> MonoidalMap k a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MonoidalMap k a -> Map k a
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 :: Ord k => k -> MonoidalMap k a -> MonoidalMap k a
delete :: k -> MonoidalMap k a -> MonoidalMap k a
delete k
k = (Unwrapped (MonoidalMap k a) -> MonoidalMap k a)
-> Iso' (MonoidalMap k a) (Unwrapped (MonoidalMap k a))
forall s. Wrapped s => (Unwrapped s -> s) -> Iso' s (Unwrapped s)
_Wrapping' Unwrapped (MonoidalMap k a) -> MonoidalMap k a
forall k a. Map k a -> MonoidalMap k a
MonoidalMap ((Map k a -> Identity (Map k a))
 -> MonoidalMap k a -> Identity (MonoidalMap k a))
-> (Map k a -> Map k a) -> MonoidalMap k a -> MonoidalMap k a
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ k -> Map k a -> Map k a
forall k a. Ord k => k -> Map k a -> Map k a
M.delete k
k
{-# INLINE delete #-}

-- | /O(n)/. Return all elements of the map and their keys
assocs :: MonoidalMap k a -> [(k,a)]
assocs :: MonoidalMap k a -> [(k, a)]
assocs = Map k a -> [(k, a)]
forall k a. Map k a -> [(k, a)]
M.assocs (Map k a -> [(k, a)])
-> (MonoidalMap k a -> Map k a) -> MonoidalMap k a -> [(k, a)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MonoidalMap k a -> Map k a
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 :: MonoidalMap k a -> [a]
elems :: MonoidalMap k a -> [a]
elems = Map k a -> [a]
forall k a. Map k a -> [a]
M.elems (Map k a -> [a])
-> (MonoidalMap k a -> Map k a) -> MonoidalMap k a -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MonoidalMap k a -> Map k a
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 :: MonoidalMap k a -> [k]
keys :: MonoidalMap k a -> [k]
keys = Map k a -> [k]
forall k a. Map k a -> [k]
M.keys (Map k a -> [k])
-> (MonoidalMap k a -> Map k a) -> MonoidalMap k a -> [k]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MonoidalMap k a -> Map k a
forall n o. Newtype n o => n -> o
unpack
{-# INLINE keys #-}

(!?) :: forall k a. Ord k => MonoidalMap k a -> k -> Maybe a
!? :: MonoidalMap k a -> k -> Maybe a
(!?) = (Map k a -> k -> Maybe a) -> MonoidalMap k a -> k -> Maybe a
coerce (Map k a -> k -> Maybe a
forall k a. Ord k => Map k a -> k -> Maybe a
(M.!?) :: M.Map k a -> k -> Maybe a)
infixl 9 !?
{-# INLINE (!?) #-}


(!) :: forall k a. Ord k => MonoidalMap k a -> k -> a
(!) = (Map k a -> k -> a) -> MonoidalMap k a -> k -> a
coerce (Map k a -> k -> a
forall k a. Ord k => Map k a -> k -> a
(M.!) :: M.Map k a -> k -> a)
infixl 9 !

(\\) :: forall k a b. Ord k => MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
\\ :: MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
(\\) = (Map k a -> Map k b -> Map k a)
-> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
coerce (Map k a -> Map k b -> Map k a
forall k a b. Ord k => Map k a -> Map k b -> Map k a
(M.\\) :: M.Map k a -> M.Map k b -> M.Map k a)
infixl 9 \\ --

null :: forall k a. MonoidalMap k a -> Bool
null :: MonoidalMap k a -> Bool
null = (Map k a -> Bool) -> MonoidalMap k a -> Bool
coerce (Map k a -> Bool
forall k a. Map k a -> Bool
M.null :: M.Map k a -> Bool)
{-# INLINE null #-}

lookup :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe a
lookup :: k -> MonoidalMap k a -> Maybe a
lookup = (k -> Map k a -> Maybe a) -> k -> MonoidalMap k a -> Maybe a
coerce (k -> Map k a -> Maybe a
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup :: k -> M.Map k a -> Maybe a)
{-# INLINE lookup #-}

lookupLT :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
lookupLT :: k -> MonoidalMap k a -> Maybe (k, a)
lookupLT = (k -> Map k a -> Maybe (k, a))
-> k -> MonoidalMap k a -> Maybe (k, a)
coerce (k -> Map k a -> Maybe (k, a)
forall k v. Ord k => k -> Map k v -> Maybe (k, v)
M.lookupLT :: k -> M.Map k a -> Maybe (k,a))
{-# INLINE lookupLT #-}

lookupGT :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
lookupGT :: k -> MonoidalMap k a -> Maybe (k, a)
lookupGT = (k -> Map k a -> Maybe (k, a))
-> k -> MonoidalMap k a -> Maybe (k, a)
coerce (k -> Map k a -> Maybe (k, a)
forall k v. Ord k => k -> Map k v -> Maybe (k, v)
M.lookupGT :: k -> M.Map k a -> Maybe (k,a))
{-# INLINE lookupGT #-}

lookupLE :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
lookupLE :: k -> MonoidalMap k a -> Maybe (k, a)
lookupLE = (k -> Map k a -> Maybe (k, a))
-> k -> MonoidalMap k a -> Maybe (k, a)
coerce (k -> Map k a -> Maybe (k, a)
forall k v. Ord k => k -> Map k v -> Maybe (k, v)
M.lookupLE :: k -> M.Map k a -> Maybe (k,a))
{-# INLINE lookupLE #-}

lookupGE :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe (k, a)
lookupGE :: k -> MonoidalMap k a -> Maybe (k, a)
lookupGE = (k -> Map k a -> Maybe (k, a))
-> k -> MonoidalMap k a -> Maybe (k, a)
coerce (k -> Map k a -> Maybe (k, a)
forall k v. Ord k => k -> Map k v -> Maybe (k, v)
M.lookupGE :: k -> M.Map k a -> Maybe (k,a))
{-# INLINE lookupGE #-}

empty :: forall k a. MonoidalMap k a
empty :: MonoidalMap k a
empty = Map k a -> MonoidalMap k a
coerce (Map k a
forall k a. Map k a
M.empty :: M.Map k a)
{-# INLINE empty #-}

insert :: forall k a. Ord k => k -> a -> MonoidalMap k a -> MonoidalMap k a
insert :: k -> a -> MonoidalMap k a -> MonoidalMap k a
insert = (k -> a -> Map k a -> Map k a)
-> k -> a -> MonoidalMap k a -> MonoidalMap k a
coerce (k -> a -> Map k a -> Map k a
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert :: k -> a -> M.Map k a -> M.Map k a)
{-# INLINE insert #-}

insertWith :: forall k a. Ord k => (a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
insertWith :: (a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
insertWith = ((a -> a -> a) -> k -> a -> Map k a -> Map k a)
-> (a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
coerce ((a -> a -> a) -> k -> a -> Map k a -> Map k a
forall k a. Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a
M.insertWith :: (a -> a -> a) -> k -> a -> M.Map k a -> M.Map k a)
{-# INLINE insertWith #-}

insertWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
insertWithKey :: (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> MonoidalMap k a
insertWithKey = ((k -> a -> a -> a) -> k -> a -> Map k a -> Map k a)
-> (k -> a -> a -> a)
-> k
-> a
-> MonoidalMap k a
-> MonoidalMap k a
coerce ((k -> a -> a -> a) -> k -> a -> Map k a -> Map k a
forall k a.
Ord k =>
(k -> a -> a -> a) -> k -> a -> Map k a -> Map k a
M.insertWithKey :: (k -> a -> a -> a) -> k -> a -> M.Map k a -> M.Map k a)
{-# INLINE insertWithKey #-}

insertLookupWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> k -> a -> MonoidalMap k a -> (Maybe a, MonoidalMap k a)
insertLookupWithKey :: (k -> a -> a -> a)
-> k -> a -> MonoidalMap k a -> (Maybe a, MonoidalMap k a)
insertLookupWithKey = ((k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a))
-> (k -> a -> a -> a)
-> k
-> a
-> MonoidalMap k a
-> (Maybe a, MonoidalMap k a)
coerce ((k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a)
forall k a.
Ord k =>
(k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a)
M.insertLookupWithKey :: (k -> a -> a -> a) -> k -> a -> M.Map k a -> (Maybe a, M.Map k a))
{-# INLINE insertLookupWithKey #-}

adjust :: forall k a. Ord k => (a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
adjust :: (a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
adjust = ((a -> a) -> k -> Map k a -> Map k a)
-> (a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
coerce ((a -> a) -> k -> Map k a -> Map k a
forall k a. Ord k => (a -> a) -> k -> Map k a -> Map k a
M.adjust :: (a -> a) -> k -> M.Map k a -> M.Map k a)
{-# INLINE adjust #-}

adjustWithKey :: forall k a. Ord k => (k -> a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
adjustWithKey :: (k -> a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
adjustWithKey = ((k -> a -> a) -> k -> Map k a -> Map k a)
-> (k -> a -> a) -> k -> MonoidalMap k a -> MonoidalMap k a
coerce ((k -> a -> a) -> k -> Map k a -> Map k a
forall k a. Ord k => (k -> a -> a) -> k -> Map k a -> Map k a
M.adjustWithKey :: (k -> a -> a) -> k -> M.Map k a -> M.Map k a)
{-# INLINE adjustWithKey #-}

update :: forall k a. Ord k => (a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
update :: (a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
update = ((a -> Maybe a) -> k -> Map k a -> Map k a)
-> (a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
coerce ((a -> Maybe a) -> k -> Map k a -> Map k a
forall k a. Ord k => (a -> Maybe a) -> k -> Map k a -> Map k a
M.update :: (a -> Maybe a) -> k -> M.Map k a -> M.Map k a)
{-# INLINE update #-}

updateWithKey :: forall k a. Ord k => (k -> a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
updateWithKey :: (k -> a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
updateWithKey = ((k -> a -> Maybe a) -> k -> Map k a -> Map k a)
-> (k -> a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
coerce ((k -> a -> Maybe a) -> k -> Map k a -> Map k a
forall k a. Ord k => (k -> a -> Maybe a) -> k -> Map k a -> Map k a
M.updateWithKey :: (k -> a -> Maybe a) -> k -> M.Map k a -> M.Map k a)
{-# INLINE updateWithKey #-}

updateLookupWithKey :: forall k a. Ord k => (k -> a -> Maybe a) -> k -> MonoidalMap k a -> (Maybe a, MonoidalMap k a)
updateLookupWithKey :: (k -> a -> Maybe a)
-> k -> MonoidalMap k a -> (Maybe a, MonoidalMap k a)
updateLookupWithKey = ((k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a))
-> (k -> a -> Maybe a)
-> k
-> MonoidalMap k a
-> (Maybe a, MonoidalMap k a)
coerce ((k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a)
forall k a.
Ord k =>
(k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a)
M.updateLookupWithKey :: (k -> a -> Maybe a) -> k -> M.Map k a -> (Maybe a, M.Map k a))
{-# INLINE updateLookupWithKey #-}

alter :: forall k a. Ord k => (Maybe a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
alter :: (Maybe a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
alter = ((Maybe a -> Maybe a) -> k -> Map k a -> Map k a)
-> (Maybe a -> Maybe a) -> k -> MonoidalMap k a -> MonoidalMap k a
coerce ((Maybe a -> Maybe a) -> k -> Map k a -> Map k a
forall k a.
Ord k =>
(Maybe a -> Maybe a) -> k -> Map k a -> Map k a
M.alter :: (Maybe a -> Maybe a) -> k -> M.Map k a -> M.Map k a)
{-# INLINE alter #-}

unionWith :: forall k a. Ord k => (a -> a -> a) -> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
unionWith :: (a -> a -> a)
-> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
unionWith = ((a -> a -> a) -> Map k a -> Map k a -> Map k a)
-> (a -> a -> a)
-> MonoidalMap k a
-> MonoidalMap k a
-> MonoidalMap k a
coerce ((a -> a -> a) -> Map k a -> Map k a -> Map k a
forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
M.unionWith :: (a -> a -> a) -> M.Map k a -> M.Map k a -> M.Map k a)
{-# INLINE unionWith #-}

unionWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
unionWithKey :: (k -> a -> a -> a)
-> MonoidalMap k a -> MonoidalMap k a -> MonoidalMap k a
unionWithKey = ((k -> a -> a -> a) -> Map k a -> Map k a -> Map k a)
-> (k -> a -> a -> a)
-> MonoidalMap k a
-> MonoidalMap k a
-> MonoidalMap k a
coerce ((k -> a -> a -> a) -> Map k a -> Map k a -> Map k a
forall k a.
Ord k =>
(k -> a -> a -> a) -> Map k a -> Map k a -> Map k a
M.unionWithKey :: (k -> a -> a -> a) -> M.Map k a -> M.Map k a -> M.Map k a)
{-# INLINE unionWithKey #-}

unionsWith :: forall k a. Ord k => (a -> a -> a) -> [MonoidalMap k a] -> MonoidalMap k a
unionsWith :: (a -> a -> a) -> [MonoidalMap k a] -> MonoidalMap k a
unionsWith = ((a -> a -> a) -> [Map k a] -> Map k a)
-> (a -> a -> a) -> [MonoidalMap k a] -> MonoidalMap k a
coerce ((a -> a -> a) -> [Map k a] -> Map k a
forall (f :: * -> *) k a.
(Foldable f, Ord k) =>
(a -> a -> a) -> f (Map k a) -> Map k a
M.unionsWith :: (a -> a -> a) -> [M.Map k a] -> M.Map k a)
{-# INLINE unionsWith #-}

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

differenceWith :: forall k a b. Ord k => (a -> b -> Maybe a) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
differenceWith :: (a -> b -> Maybe a)
-> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
differenceWith = ((a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a)
-> (a -> b -> Maybe a)
-> MonoidalMap k a
-> MonoidalMap k b
-> MonoidalMap k a
coerce ((a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a
forall k a b.
Ord k =>
(a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a
M.differenceWith :: (a -> b -> Maybe a) -> M.Map k a -> M.Map k b -> M.Map k a)
{-# INLINE differenceWith #-}

differenceWithKey :: forall k a b. Ord k => (k -> a -> b -> Maybe a) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
differenceWithKey :: (k -> a -> b -> Maybe a)
-> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k a
differenceWithKey = ((k -> a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a)
-> (k -> a -> b -> Maybe a)
-> MonoidalMap k a
-> MonoidalMap k b
-> MonoidalMap k a
coerce ((k -> a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a
forall k a b.
Ord k =>
(k -> a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a
M.differenceWithKey :: (k -> a -> b -> Maybe a) -> M.Map k a -> M.Map k b -> M.Map k a)
{-# INLINE differenceWithKey #-}

intersectionWith :: forall k a b c. Ord k => (a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
intersectionWith :: (a -> b -> c)
-> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
intersectionWith = ((a -> b -> c) -> Map k a -> Map k b -> Map k c)
-> (a -> b -> c)
-> MonoidalMap k a
-> MonoidalMap k b
-> MonoidalMap k c
coerce ((a -> b -> c) -> Map k a -> Map k b -> Map k c
forall k a b c.
Ord k =>
(a -> b -> c) -> Map k a -> Map k b -> Map k c
M.intersectionWith :: (a -> b -> c) -> M.Map k a -> M.Map k b -> M.Map k c)
{-# INLINE intersectionWith #-}

intersectionWithKey :: forall k a b c. Ord k => (k -> a -> b -> c) -> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
intersectionWithKey :: (k -> a -> b -> c)
-> MonoidalMap k a -> MonoidalMap k b -> MonoidalMap k c
intersectionWithKey = ((k -> a -> b -> c) -> Map k a -> Map k b -> Map k c)
-> (k -> a -> b -> c)
-> MonoidalMap k a
-> MonoidalMap k b
-> MonoidalMap k c
coerce ((k -> a -> b -> c) -> Map k a -> Map k b -> Map k c
forall k a b c.
Ord k =>
(k -> a -> b -> c) -> Map k a -> Map k b -> Map k c
M.intersectionWithKey :: (k -> a -> b -> c) -> M.Map k a -> M.Map k b -> M.Map k c)
{-# INLINE intersectionWithKey #-}

mergeWithKey :: forall k a b c. 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
mergeWithKey :: (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
mergeWithKey = ((k -> a -> b -> Maybe c)
 -> (Map k a -> Map k c)
 -> (Map k b -> Map k c)
 -> Map k a
 -> Map k b
 -> Map k c)
-> (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
coerce ((k -> a -> b -> Maybe c)
-> (Map k a -> Map k c)
-> (Map k b -> Map k c)
-> Map k a
-> Map k b
-> Map k c
forall k a b c.
Ord k =>
(k -> a -> b -> Maybe c)
-> (Map k a -> Map k c)
-> (Map k b -> Map k c)
-> Map k a
-> Map k b
-> Map k c
M.mergeWithKey :: (k -> a -> b -> Maybe c) -> (M.Map k a -> M.Map k c) -> (M.Map k b -> M.Map k c) -> M.Map k a -> M.Map k b -> M.Map k c)
{-# INLINE mergeWithKey #-}

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

mapWithKey :: forall k a  b. (k -> a -> b) -> MonoidalMap k a -> MonoidalMap k b
mapWithKey :: (k -> a -> b) -> MonoidalMap k a -> MonoidalMap k b
mapWithKey = ((k -> a -> b) -> Map k a -> Map k b)
-> (k -> a -> b) -> MonoidalMap k a -> MonoidalMap k b
coerce ((k -> a -> b) -> Map k a -> Map k b
forall k a b. (k -> a -> b) -> Map k a -> Map k b
M.mapWithKey :: (k -> a -> b) -> M.Map k a -> M.Map k b)
{-# INLINE mapWithKey #-}

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

traverseMaybeWithKey :: forall f k a b. Applicative f => (k -> a -> f (Maybe b)) -> MonoidalMap k a -> f (MonoidalMap k b)
traverseMaybeWithKey :: (k -> a -> f (Maybe b)) -> MonoidalMap k a -> f (MonoidalMap k b)
traverseMaybeWithKey k -> a -> f (Maybe b)
f MonoidalMap k a
m = Map k b -> MonoidalMap k b
coerce (Map k b -> MonoidalMap k b) -> f (Map k b) -> f (MonoidalMap k b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (k -> a -> f (Maybe b)) -> Map k a -> f (Map k b)
forall (f :: * -> *) k a b.
Applicative f =>
(k -> a -> f (Maybe b)) -> Map k a -> f (Map k b)
M.traverseMaybeWithKey k -> a -> f (Maybe b)
f (MonoidalMap k a -> Map k a
coerce MonoidalMap k a
m)
{-# INLINE traverseMaybeWithKey #-}

mapAccum :: forall k a b c. (a -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
mapAccum :: (a -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
mapAccum = ((a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c))
-> (a -> b -> (a, c))
-> a
-> MonoidalMap k b
-> (a, MonoidalMap k c)
coerce ((a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
forall a b c k. (a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
M.mapAccum :: (a -> b -> (a, c)) -> a -> M.Map k b -> (a, M.Map k c))
{-# INLINE mapAccum #-}

mapAccumWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
mapAccumWithKey :: (a -> k -> b -> (a, c))
-> a -> MonoidalMap k b -> (a, MonoidalMap k c)
mapAccumWithKey = ((a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c))
-> (a -> k -> b -> (a, c))
-> a
-> MonoidalMap k b
-> (a, MonoidalMap k c)
coerce ((a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
forall a k b c.
(a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
M.mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> M.Map k b -> (a, M.Map k c))
{-# INLINE mapAccumWithKey #-}

mapAccumRWithKey :: forall k a b c. (a -> k -> b -> (a, c)) -> a -> MonoidalMap k b -> (a, MonoidalMap k c)
mapAccumRWithKey :: (a -> k -> b -> (a, c))
-> a -> MonoidalMap k b -> (a, MonoidalMap k c)
mapAccumRWithKey = ((a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c))
-> (a -> k -> b -> (a, c))
-> a
-> MonoidalMap k b
-> (a, MonoidalMap k c)
coerce ((a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
forall a k b c.
(a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
M.mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> M.Map k b -> (a, M.Map k c))
{-# INLINE mapAccumRWithKey #-}

mapKeys :: forall k1 k2 a. Ord k2 => (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
mapKeys :: (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
mapKeys = ((k1 -> k2) -> Map k1 a -> Map k2 a)
-> (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
coerce ((k1 -> k2) -> Map k1 a -> Map k2 a
forall k2 k1 a. Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a
M.mapKeys :: (k1 -> k2) -> M.Map k1 a -> M.Map k2 a)
{-# INLINE mapKeys #-}

mapKeysWith :: forall k1 k2 a. Ord k2 => (a -> a -> a) -> (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
mapKeysWith :: (a -> a -> a) -> (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
mapKeysWith = ((a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a)
-> (a -> a -> a)
-> (k1 -> k2)
-> MonoidalMap k1 a
-> MonoidalMap k2 a
coerce ((a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a
forall k2 a k1.
Ord k2 =>
(a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a
M.mapKeysWith :: (a -> a -> a) -> (k1 -> k2) -> M.Map k1 a -> M.Map k2 a)
{-# INLINE mapKeysWith #-}

-- | /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
mapKeysMonotonic :: forall k1 k2 a. (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
mapKeysMonotonic :: (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
mapKeysMonotonic = ((k1 -> k2) -> Map k1 a -> Map k2 a)
-> (k1 -> k2) -> MonoidalMap k1 a -> MonoidalMap k2 a
coerce ((k1 -> k2) -> Map k1 a -> Map k2 a
forall k1 k2 a. (k1 -> k2) -> Map k1 a -> Map k2 a
M.mapKeysMonotonic :: (k1 -> k2) -> M.Map k1 a -> M.Map k2 a)
{-# INLINE mapKeysMonotonic #-}

foldr :: forall k a b. (a -> b -> b) -> b -> MonoidalMap k a -> b
foldr :: (a -> b -> b) -> b -> MonoidalMap k a -> b
foldr = ((a -> b -> b) -> b -> Map k a -> b)
-> (a -> b -> b) -> b -> MonoidalMap k a -> b
coerce ((a -> b -> b) -> b -> Map k a -> b
forall a b k. (a -> b -> b) -> b -> Map k a -> b
M.foldr :: (a -> b -> b) -> b -> M.Map k a -> b)
{-# INLINE foldr #-}

foldl :: forall k a b. (a -> b -> a) -> a -> MonoidalMap k b -> a
foldl :: (a -> b -> a) -> a -> MonoidalMap k b -> a
foldl = ((a -> b -> a) -> a -> Map k b -> a)
-> (a -> b -> a) -> a -> MonoidalMap k b -> a
coerce ((a -> b -> a) -> a -> Map k b -> a
forall a b k. (a -> b -> a) -> a -> Map k b -> a
M.foldl :: (a -> b -> a) -> a -> M.Map k b -> a)
{-# INLINE foldl #-}

foldrWithKey :: forall k a b. (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
foldrWithKey :: (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
foldrWithKey = ((k -> a -> b -> b) -> b -> Map k a -> b)
-> (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
coerce ((k -> a -> b -> b) -> b -> Map k a -> b
forall k a b. (k -> a -> b -> b) -> b -> Map k a -> b
M.foldrWithKey :: (k -> a -> b -> b) -> b -> M.Map k a -> b)
{-# INLINE foldrWithKey #-}

foldlWithKey :: forall k a b. (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
foldlWithKey :: (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
foldlWithKey = ((a -> k -> b -> a) -> a -> Map k b -> a)
-> (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
coerce ((a -> k -> b -> a) -> a -> Map k b -> a
forall a k b. (a -> k -> b -> a) -> a -> Map k b -> a
M.foldlWithKey :: (a -> k -> b -> a) -> a -> M.Map k b -> a)
{-# INLINE foldlWithKey #-}

foldMapWithKey :: forall k a m. Monoid m => (k -> a -> m) -> MonoidalMap k a -> m
foldMapWithKey :: (k -> a -> m) -> MonoidalMap k a -> m
foldMapWithKey = ((k -> a -> m) -> Map k a -> m)
-> (k -> a -> m) -> MonoidalMap k a -> m
coerce (Monoid m => (k -> a -> m) -> Map k a -> m
forall m k a. Monoid m => (k -> a -> m) -> Map k a -> m
M.foldMapWithKey :: Monoid m => (k -> a -> m) -> M.Map k a -> m)
{-# INLINE foldMapWithKey #-}

foldr' :: forall k a b. (a -> b -> b) -> b -> MonoidalMap k a -> b
foldr' :: (a -> b -> b) -> b -> MonoidalMap k a -> b
foldr' = ((a -> b -> b) -> b -> Map k a -> b)
-> (a -> b -> b) -> b -> MonoidalMap k a -> b
coerce ((a -> b -> b) -> b -> Map k a -> b
forall a b k. (a -> b -> b) -> b -> Map k a -> b
M.foldr' :: (a -> b -> b) -> b -> M.Map k a -> b)
{-# INLINE foldr' #-}

foldl' :: forall k a b. (a -> b -> a) -> a -> MonoidalMap k b -> a
foldl' :: (a -> b -> a) -> a -> MonoidalMap k b -> a
foldl' = ((a -> b -> a) -> a -> Map k b -> a)
-> (a -> b -> a) -> a -> MonoidalMap k b -> a
coerce ((a -> b -> a) -> a -> Map k b -> a
forall a b k. (a -> b -> a) -> a -> Map k b -> a
M.foldl' :: (a -> b -> a) -> a -> M.Map k b -> a)
{-# INLINE foldl' #-}

foldrWithKey' :: forall k a b. (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
foldrWithKey' :: (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
foldrWithKey' = ((k -> a -> b -> b) -> b -> Map k a -> b)
-> (k -> a -> b -> b) -> b -> MonoidalMap k a -> b
coerce ((k -> a -> b -> b) -> b -> Map k a -> b
forall k a b. (k -> a -> b -> b) -> b -> Map k a -> b
M.foldrWithKey' :: (k -> a -> b -> b) -> b -> M.Map k a -> b)
{-# INLINE foldrWithKey' #-}

foldlWithKey' :: forall k a b. (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
foldlWithKey' :: (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
foldlWithKey' = ((a -> k -> b -> a) -> a -> Map k b -> a)
-> (a -> k -> b -> a) -> a -> MonoidalMap k b -> a
coerce ((a -> k -> b -> a) -> a -> Map k b -> a
forall a k b. (a -> k -> b -> a) -> a -> Map k b -> a
M.foldlWithKey' :: (a -> k -> b -> a) -> a -> M.Map k b -> a)
{-# INLINE foldlWithKey' #-}

keysSet :: forall k a. MonoidalMap k a -> Set k
keysSet :: MonoidalMap k a -> Set k
keysSet = (Map k a -> Set k) -> MonoidalMap k a -> Set k
coerce (Map k a -> Set k
forall k a. Map k a -> Set k
M.keysSet :: M.Map k a -> Set k)
{-# INLINE keysSet #-}

fromSet :: forall k a. (k -> a) -> Set k -> MonoidalMap k a
fromSet :: (k -> a) -> Set k -> MonoidalMap k a
fromSet = ((k -> a) -> Set k -> Map k a)
-> (k -> a) -> Set k -> MonoidalMap k a
coerce ((k -> a) -> Set k -> Map k a
forall k a. (k -> a) -> Set k -> Map k a
M.fromSet :: (k -> a) -> Set k -> M.Map k a)
{-# INLINE fromSet #-}

toList :: forall k a. MonoidalMap k a -> [(k, a)]
toList :: MonoidalMap k a -> [(k, a)]
toList = (Map k a -> [(k, a)]) -> MonoidalMap k a -> [(k, a)]
coerce (Map k a -> [(k, a)]
forall k a. Map k a -> [(k, a)]
M.toList :: M.Map k a -> [(k, a)])
{-# INLINE toList #-}

fromList :: forall k a. Ord k => [(k, a)] -> MonoidalMap k a
fromList :: [(k, a)] -> MonoidalMap k a
fromList = ([(k, a)] -> Map k a) -> [(k, a)] -> MonoidalMap k a
coerce ([(k, a)] -> Map k a
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList :: [(k, a)] -> M.Map k a)
{-# INLINE fromList #-}

fromListWith :: forall k a. Ord k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromListWith :: (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromListWith = ((a -> a -> a) -> [(k, a)] -> Map k a)
-> (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
coerce ((a -> a -> a) -> [(k, a)] -> Map k a
forall k a. Ord k => (a -> a -> a) -> [(k, a)] -> Map k a
M.fromListWith :: (a -> a -> a) -> [(k, a)] -> M.Map k a)
{-# INLINE fromListWith #-}

fromListWithKey :: forall k a. Ord k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromListWithKey = ((k -> a -> a -> a) -> [(k, a)] -> Map k a)
-> (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
coerce ((k -> a -> a -> a) -> [(k, a)] -> Map k a
forall k a. Ord k => (k -> a -> a -> a) -> [(k, a)] -> Map k a
M.fromListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> M.Map k a)
{-# INLINE fromListWithKey #-}

toAscList :: forall k a. MonoidalMap k a -> [(k, a)]
toAscList :: MonoidalMap k a -> [(k, a)]
toAscList = (Map k a -> [(k, a)]) -> MonoidalMap k a -> [(k, a)]
coerce (Map k a -> [(k, a)]
forall k a. Map k a -> [(k, a)]
M.toAscList :: M.Map k a -> [(k, a)])
{-# INLINE toAscList #-}

toDescList :: forall k a. MonoidalMap k a -> [(k, a)]
toDescList :: MonoidalMap k a -> [(k, a)]
toDescList = (Map k a -> [(k, a)]) -> MonoidalMap k a -> [(k, a)]
coerce (Map k a -> [(k, a)]
forall k a. Map k a -> [(k, a)]
M.toDescList :: M.Map k a -> [(k, a)])
{-# INLINE toDescList #-}

fromAscList :: forall k a. Eq k => [(k, a)] -> MonoidalMap k a
fromAscList :: [(k, a)] -> MonoidalMap k a
fromAscList = ([(k, a)] -> Map k a) -> [(k, a)] -> MonoidalMap k a
coerce ([(k, a)] -> Map k a
forall k a. Eq k => [(k, a)] -> Map k a
M.fromAscList :: [(k, a)] -> M.Map k a)
{-# INLINE fromAscList #-}

fromAscListWith :: forall k a. Eq k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromAscListWith :: (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromAscListWith = ((a -> a -> a) -> [(k, a)] -> Map k a)
-> (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
coerce ((a -> a -> a) -> [(k, a)] -> Map k a
forall k a. Eq k => (a -> a -> a) -> [(k, a)] -> Map k a
M.fromAscListWith :: (a -> a -> a) -> [(k, a)] -> M.Map k a)
{-# INLINE fromAscListWith #-}

fromAscListWithKey :: forall k a. Eq k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromAscListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromAscListWithKey = ((k -> a -> a -> a) -> [(k, a)] -> Map k a)
-> (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
coerce ((k -> a -> a -> a) -> [(k, a)] -> Map k a
forall k a. Eq k => (k -> a -> a -> a) -> [(k, a)] -> Map k a
M.fromAscListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> M.Map k a)
{-# INLINE fromAscListWithKey #-}

fromDistinctAscList :: forall k a. [(k, a)] -> MonoidalMap k a
fromDistinctAscList :: [(k, a)] -> MonoidalMap k a
fromDistinctAscList = ([(k, a)] -> Map k a) -> [(k, a)] -> MonoidalMap k a
coerce ([(k, a)] -> Map k a
forall k a. [(k, a)] -> Map k a
M.fromDistinctAscList :: [(k, a)] -> M.Map k a)
{-# INLINE fromDistinctAscList #-}

fromDistinctList :: forall k a. Ord k => [(k, a)] -> MonoidalMap k a
fromDistinctList :: [(k, a)] -> MonoidalMap k a
fromDistinctList = ([(k, a)] -> Map k a) -> [(k, a)] -> MonoidalMap k a
coerce ([(k, a)] -> Map k a
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList :: [(k, a)] -> M.Map k a)
{-# INLINE fromDistinctList #-}

fromDescList :: forall k a. Eq k => [(k, a)] -> MonoidalMap k a
fromDescList :: [(k, a)] -> MonoidalMap k a
fromDescList = ([(k, a)] -> Map k a) -> [(k, a)] -> MonoidalMap k a
coerce ([(k, a)] -> Map k a
forall k a. Eq k => [(k, a)] -> Map k a
M.fromDescList :: [(k, a)] -> M.Map k a)
{-# INLINE fromDescList #-}

fromDescListWith :: forall k a. Eq k => (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromDescListWith :: (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromDescListWith = ((a -> a -> a) -> [(k, a)] -> Map k a)
-> (a -> a -> a) -> [(k, a)] -> MonoidalMap k a
coerce ((a -> a -> a) -> [(k, a)] -> Map k a
forall k a. Eq k => (a -> a -> a) -> [(k, a)] -> Map k a
M.fromDescListWith :: (a -> a -> a) -> [(k, a)] -> M.Map k a)
{-# INLINE fromDescListWith #-}

fromDescListWithKey :: forall k a. Eq k => (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromDescListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
fromDescListWithKey = ((k -> a -> a -> a) -> [(k, a)] -> Map k a)
-> (k -> a -> a -> a) -> [(k, a)] -> MonoidalMap k a
coerce ((k -> a -> a -> a) -> [(k, a)] -> Map k a
forall k a. Eq k => (k -> a -> a -> a) -> [(k, a)] -> Map k a
M.fromDescListWithKey :: (k -> a -> a -> a) -> [(k, a)] -> M.Map k a)
{-# INLINE fromDescListWithKey #-}

fromDistinctDescList :: forall k a. [(k, a)] -> MonoidalMap k a
fromDistinctDescList :: [(k, a)] -> MonoidalMap k a
fromDistinctDescList = ([(k, a)] -> Map k a) -> [(k, a)] -> MonoidalMap k a
coerce ([(k, a)] -> Map k a
forall k a. [(k, a)] -> Map k a
M.fromDistinctDescList :: [(k, a)] -> M.Map k a)
{-# INLINE fromDistinctDescList #-}

filter :: forall k a. (a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
filter :: (a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
filter = ((a -> Bool) -> Map k a -> Map k a)
-> (a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
coerce ((a -> Bool) -> Map k a -> Map k a
forall a k. (a -> Bool) -> Map k a -> Map k a
M.filter :: (a -> Bool) -> M.Map k a -> M.Map k a)
{-# INLINE filter #-}

filterWithKey :: forall k a. (k -> a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
filterWithKey :: (k -> a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
filterWithKey = ((k -> a -> Bool) -> Map k a -> Map k a)
-> (k -> a -> Bool) -> MonoidalMap k a -> MonoidalMap k a
coerce ((k -> a -> Bool) -> Map k a -> Map k a
forall k a. (k -> a -> Bool) -> Map k a -> Map k a
M.filterWithKey :: (k -> a -> Bool) -> M.Map k a -> M.Map k a)
{-# INLINE filterWithKey #-}

restrictKeys :: forall k a. Ord k => MonoidalMap k a -> Set k -> MonoidalMap k a
restrictKeys :: MonoidalMap k a -> Set k -> MonoidalMap k a
restrictKeys = (Map k a -> Set k -> Map k a)
-> MonoidalMap k a -> Set k -> MonoidalMap k a
coerce (Map k a -> Set k -> Map k a
forall k a. Ord k => Map k a -> Set k -> Map k a
M.restrictKeys :: M.Map k a -> Set k -> M.Map k a)
{-# INLINE restrictKeys #-}

withoutKeys :: forall k a. Ord k => MonoidalMap k a -> Set k -> MonoidalMap k a
withoutKeys :: MonoidalMap k a -> Set k -> MonoidalMap k a
withoutKeys = (Map k a -> Set k -> Map k a)
-> MonoidalMap k a -> Set k -> MonoidalMap k a
coerce (Map k a -> Set k -> Map k a
forall k a. Ord k => Map k a -> Set k -> Map k a
M.withoutKeys :: M.Map k a -> Set k -> M.Map k a)
{-# INLINE withoutKeys #-}

partition :: forall k a. (a -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
partition :: (a -> Bool)
-> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
partition = ((a -> Bool) -> Map k a -> (Map k a, Map k a))
-> (a -> Bool)
-> MonoidalMap k a
-> (MonoidalMap k a, MonoidalMap k a)
coerce ((a -> Bool) -> Map k a -> (Map k a, Map k a)
forall a k. (a -> Bool) -> Map k a -> (Map k a, Map k a)
M.partition :: (a -> Bool) -> M.Map k a -> (M.Map k a, M.Map k a))
{-# INLINE partition #-}

partitionWithKey :: forall k a. (k -> a -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
partitionWithKey :: (k -> a -> Bool)
-> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
partitionWithKey = ((k -> a -> Bool) -> Map k a -> (Map k a, Map k a))
-> (k -> a -> Bool)
-> MonoidalMap k a
-> (MonoidalMap k a, MonoidalMap k a)
coerce ((k -> a -> Bool) -> Map k a -> (Map k a, Map k a)
forall k a. (k -> a -> Bool) -> Map k a -> (Map k a, Map k a)
M.partitionWithKey :: (k -> a -> Bool) -> M.Map k a -> (M.Map k a, M.Map k a))
{-# INLINE partitionWithKey #-}

takeWhileAntitone :: forall k a. (k -> Bool) -> MonoidalMap k a -> MonoidalMap k a
takeWhileAntitone :: (k -> Bool) -> MonoidalMap k a -> MonoidalMap k a
takeWhileAntitone = ((k -> Bool) -> Map k a -> Map k a)
-> (k -> Bool) -> MonoidalMap k a -> MonoidalMap k a
coerce ((k -> Bool) -> Map k a -> Map k a
forall k a. (k -> Bool) -> Map k a -> Map k a
M.takeWhileAntitone :: (k -> Bool) -> M.Map k a -> M.Map k a)
{-# INLINE takeWhileAntitone #-}

dropWhileAntitone :: forall k a. (k -> Bool) -> MonoidalMap k a -> MonoidalMap k a
dropWhileAntitone :: (k -> Bool) -> MonoidalMap k a -> MonoidalMap k a
dropWhileAntitone = ((k -> Bool) -> Map k a -> Map k a)
-> (k -> Bool) -> MonoidalMap k a -> MonoidalMap k a
coerce ((k -> Bool) -> Map k a -> Map k a
forall k a. (k -> Bool) -> Map k a -> Map k a
M.dropWhileAntitone :: (k -> Bool) -> M.Map k a -> M.Map k a)
{-# INLINE dropWhileAntitone #-}

spanAntitone :: forall k a. (k -> Bool) -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
spanAntitone :: (k -> Bool)
-> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
spanAntitone = ((k -> Bool) -> Map k a -> (Map k a, Map k a))
-> (k -> Bool)
-> MonoidalMap k a
-> (MonoidalMap k a, MonoidalMap k a)
coerce ((k -> Bool) -> Map k a -> (Map k a, Map k a)
forall k a. (k -> Bool) -> Map k a -> (Map k a, Map k a)
M.spanAntitone :: (k -> Bool) -> M.Map k a -> (M.Map k a, M.Map k a))
{-# INLINE spanAntitone #-}

mapMaybe :: forall k a b. (a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
mapMaybe :: (a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
mapMaybe = ((a -> Maybe b) -> Map k a -> Map k b)
-> (a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
coerce ((a -> Maybe b) -> Map k a -> Map k b
forall a b k. (a -> Maybe b) -> Map k a -> Map k b
M.mapMaybe :: (a -> Maybe b) -> M.Map k a -> M.Map k b)
{-# INLINE mapMaybe #-}

mapMaybeWithKey :: forall k a b. (k -> a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
mapMaybeWithKey :: (k -> a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
mapMaybeWithKey = ((k -> a -> Maybe b) -> Map k a -> Map k b)
-> (k -> a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k b
coerce ((k -> a -> Maybe b) -> Map k a -> Map k b
forall k a b. (k -> a -> Maybe b) -> Map k a -> Map k b
M.mapMaybeWithKey :: (k -> a -> Maybe b) -> M.Map k a -> M.Map k b)
{-# INLINE mapMaybeWithKey #-}

mapEither :: forall k a b c. (a -> Either b c) -> MonoidalMap k a -> (MonoidalMap k b, MonoidalMap k c)
mapEither :: (a -> Either b c)
-> MonoidalMap k a -> (MonoidalMap k b, MonoidalMap k c)
mapEither = ((a -> Either b c) -> Map k a -> (Map k b, Map k c))
-> (a -> Either b c)
-> MonoidalMap k a
-> (MonoidalMap k b, MonoidalMap k c)
coerce ((a -> Either b c) -> Map k a -> (Map k b, Map k c)
forall a b c k. (a -> Either b c) -> Map k a -> (Map k b, Map k c)
M.mapEither :: (a -> Either b c) -> M.Map k a -> (M.Map k b, M.Map k c))
{-# INLINE mapEither #-}

mapEitherWithKey :: forall k a b c. (k -> 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)
mapEitherWithKey = ((k -> a -> Either b c) -> Map k a -> (Map k b, Map k c))
-> (k -> a -> Either b c)
-> MonoidalMap k a
-> (MonoidalMap k b, MonoidalMap k c)
coerce ((k -> a -> Either b c) -> Map k a -> (Map k b, Map k c)
forall k a b c.
(k -> a -> Either b c) -> Map k a -> (Map k b, Map k c)
M.mapEitherWithKey :: (k -> a -> Either b c) -> M.Map k a -> (M.Map k b, M.Map k c))
{-# INLINE mapEitherWithKey #-}

split :: forall k a. Ord k => k -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
split :: k -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
split = (k -> Map k a -> (Map k a, Map k a))
-> k -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
coerce (k -> Map k a -> (Map k a, Map k a)
forall k a. Ord k => k -> Map k a -> (Map k a, Map k a)
M.split :: k -> M.Map k a -> (M.Map k a, M.Map k a))
{-# INLINE split #-}

splitLookup :: forall k a. Ord k => k -> MonoidalMap k a -> (MonoidalMap k a, Maybe a, MonoidalMap k a)
splitLookup :: k -> MonoidalMap k a -> (MonoidalMap k a, Maybe a, MonoidalMap k a)
splitLookup = (k -> Map k a -> (Map k a, Maybe a, Map k a))
-> k
-> MonoidalMap k a
-> (MonoidalMap k a, Maybe a, MonoidalMap k a)
coerce (k -> Map k a -> (Map k a, Maybe a, Map k a)
forall k a. Ord k => k -> Map k a -> (Map k a, Maybe a, Map k a)
M.splitLookup :: k -> M.Map k a -> (M.Map k a, Maybe a, M.Map k a))
{-# INLINE splitLookup #-}

splitRoot :: forall k a. MonoidalMap k a -> [MonoidalMap k a]
splitRoot :: MonoidalMap k a -> [MonoidalMap k a]
splitRoot = (Map k a -> [Map k a]) -> MonoidalMap k a -> [MonoidalMap k a]
coerce (Map k a -> [Map k a]
forall k b. Map k b -> [Map k b]
M.splitRoot :: M.Map k a -> [M.Map k a])
{-# INLINE splitRoot #-}

isSubmapOf :: forall k a. (Ord k, Eq a) => MonoidalMap k a -> MonoidalMap k a -> Bool
isSubmapOf :: MonoidalMap k a -> MonoidalMap k a -> Bool
isSubmapOf = (Map k a -> Map k a -> Bool)
-> MonoidalMap k a -> MonoidalMap k a -> Bool
coerce (Map k a -> Map k a -> Bool
forall k a. (Ord k, Eq a) => Map k a -> Map k a -> Bool
M.isSubmapOf :: M.Map k a -> M.Map k a -> Bool)
{-# INLINE isSubmapOf #-}

isSubmapOfBy :: forall k a b. Ord k => (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
isSubmapOfBy :: (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
isSubmapOfBy = ((a -> b -> Bool) -> Map k a -> Map k b -> Bool)
-> (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
coerce ((a -> b -> Bool) -> Map k a -> Map k b -> Bool
forall k a b.
Ord k =>
(a -> b -> Bool) -> Map k a -> Map k b -> Bool
M.isSubmapOfBy :: (a -> b -> Bool) -> M.Map k a -> M.Map k b -> Bool)
{-# INLINE isSubmapOfBy #-}

isProperSubmapOf :: forall k a. (Ord k, Eq a) => MonoidalMap k a -> MonoidalMap k a -> Bool
isProperSubmapOf :: MonoidalMap k a -> MonoidalMap k a -> Bool
isProperSubmapOf = (Map k a -> Map k a -> Bool)
-> MonoidalMap k a -> MonoidalMap k a -> Bool
coerce (Map k a -> Map k a -> Bool
forall k a. (Ord k, Eq a) => Map k a -> Map k a -> Bool
M.isProperSubmapOf :: M.Map k a -> M.Map k a -> Bool)
{-# INLINE isProperSubmapOf #-}

isProperSubmapOfBy :: forall k a b. Ord k => (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
isProperSubmapOfBy :: (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
isProperSubmapOfBy = ((a -> b -> Bool) -> Map k a -> Map k b -> Bool)
-> (a -> b -> Bool) -> MonoidalMap k a -> MonoidalMap k b -> Bool
coerce ((a -> b -> Bool) -> Map k a -> Map k b -> Bool
forall k a b.
Ord k =>
(a -> b -> Bool) -> Map k a -> Map k b -> Bool
M.isProperSubmapOfBy :: (a -> b -> Bool) -> M.Map k a -> M.Map k b -> Bool)
{-# INLINE isProperSubmapOfBy #-}

lookupIndex :: forall k a. Ord k => k -> MonoidalMap k a -> Maybe Int
lookupIndex :: k -> MonoidalMap k a -> Maybe Int
lookupIndex = (k -> Map k a -> Maybe Int) -> k -> MonoidalMap k a -> Maybe Int
coerce (k -> Map k a -> Maybe Int
forall k a. Ord k => k -> Map k a -> Maybe Int
M.lookupIndex :: k -> M.Map k a -> Maybe Int)
{-# INLINE lookupIndex #-}

findIndex :: forall k a. Ord k => k -> MonoidalMap k a -> Int
findIndex :: k -> MonoidalMap k a -> Int
findIndex = (k -> Map k a -> Int) -> k -> MonoidalMap k a -> Int
coerce (k -> Map k a -> Int
forall k a. Ord k => k -> Map k a -> Int
M.findIndex :: k -> M.Map k a -> Int)
{-# INLINE findIndex #-}

elemAt :: forall k a. Int -> MonoidalMap k a -> (k, a)
elemAt :: Int -> MonoidalMap k a -> (k, a)
elemAt = (Int -> Map k a -> (k, a)) -> Int -> MonoidalMap k a -> (k, a)
coerce (Int -> Map k a -> (k, a)
forall k a. Int -> Map k a -> (k, a)
M.elemAt :: Int -> M.Map k a -> (k, a))
{-# INLINE elemAt #-}

updateAt :: forall k a. (k -> a -> Maybe a) -> Int -> MonoidalMap k a -> MonoidalMap k a
updateAt :: (k -> a -> Maybe a) -> Int -> MonoidalMap k a -> MonoidalMap k a
updateAt = ((k -> a -> Maybe a) -> Int -> Map k a -> Map k a)
-> (k -> a -> Maybe a) -> Int -> MonoidalMap k a -> MonoidalMap k a
coerce ((k -> a -> Maybe a) -> Int -> Map k a -> Map k a
forall k a. (k -> a -> Maybe a) -> Int -> Map k a -> Map k a
M.updateAt :: (k -> a -> Maybe a) -> Int -> M.Map k a -> M.Map k a)
{-# INLINE updateAt #-}

deleteAt :: forall k a. Int -> MonoidalMap k a -> MonoidalMap k a
deleteAt :: Int -> MonoidalMap k a -> MonoidalMap k a
deleteAt = (Int -> Map k a -> Map k a)
-> Int -> MonoidalMap k a -> MonoidalMap k a
coerce (Int -> Map k a -> Map k a
forall k a. Int -> Map k a -> Map k a
M.deleteAt :: Int -> M.Map k a -> M.Map k a)
{-# INLINE deleteAt #-}

take :: forall k a. Int -> MonoidalMap k a -> MonoidalMap k a
take :: Int -> MonoidalMap k a -> MonoidalMap k a
take = (Int -> Map k a -> Map k a)
-> Int -> MonoidalMap k a -> MonoidalMap k a
coerce (Int -> Map k a -> Map k a
forall k a. Int -> Map k a -> Map k a
M.take :: Int -> M.Map k a -> M.Map k a)
{-# INLINE take #-}

drop :: forall k a. Int -> MonoidalMap k a -> MonoidalMap k a
drop :: Int -> MonoidalMap k a -> MonoidalMap k a
drop = (Int -> Map k a -> Map k a)
-> Int -> MonoidalMap k a -> MonoidalMap k a
coerce (Int -> Map k a -> Map k a
forall k a. Int -> Map k a -> Map k a
M.drop :: Int -> M.Map k a -> M.Map k a)
{-# INLINE drop #-}

splitAt :: forall k a. Int -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
splitAt :: Int -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
splitAt = (Int -> Map k a -> (Map k a, Map k a))
-> Int -> MonoidalMap k a -> (MonoidalMap k a, MonoidalMap k a)
coerce (Int -> Map k a -> (Map k a, Map k a)
forall k a. Int -> Map k a -> (Map k a, Map k a)
M.splitAt :: Int -> M.Map k a -> (M.Map k a, M.Map k a))
{-# INLINE splitAt #-}

lookupMin :: forall k a. MonoidalMap k a -> Maybe (k, a)
lookupMin :: MonoidalMap k a -> Maybe (k, a)
lookupMin = (Map k a -> Maybe (k, a)) -> MonoidalMap k a -> Maybe (k, a)
coerce (Map k a -> Maybe (k, a)
forall k a. Map k a -> Maybe (k, a)
M.lookupMin :: M.Map k a -> Maybe (k, a))
{-# INLINE lookupMin #-}

lookupMax :: forall k a. MonoidalMap k a -> Maybe (k, a)
lookupMax :: MonoidalMap k a -> Maybe (k, a)
lookupMax = (Map k a -> Maybe (k, a)) -> MonoidalMap k a -> Maybe (k, a)
coerce (Map k a -> Maybe (k, a)
forall k a. Map k a -> Maybe (k, a)
M.lookupMax :: M.Map k a -> Maybe (k, a))
{-# INLINE lookupMax #-}

findMin :: forall k a. MonoidalMap k a -> (k, a)
findMin :: MonoidalMap k a -> (k, a)
findMin = (Map k a -> (k, a)) -> MonoidalMap k a -> (k, a)
coerce (Map k a -> (k, a)
forall k a. Map k a -> (k, a)
M.findMin :: M.Map k a -> (k, a))
{-# INLINE findMin #-}

findMax :: forall k a. MonoidalMap k a -> (k, a)
findMax :: MonoidalMap k a -> (k, a)
findMax = (Map k a -> (k, a)) -> MonoidalMap k a -> (k, a)
coerce (Map k a -> (k, a)
forall k a. Map k a -> (k, a)
M.findMax :: M.Map k a -> (k, a))
{-# INLINE findMax #-}

deleteMin :: forall k a. MonoidalMap k a -> MonoidalMap k a
deleteMin :: MonoidalMap k a -> MonoidalMap k a
deleteMin = (Map k a -> Map k a) -> MonoidalMap k a -> MonoidalMap k a
coerce (Map k a -> Map k a
forall k a. Map k a -> Map k a
M.deleteMin :: M.Map k a -> M.Map k a)
{-# INLINE deleteMin #-}

deleteMax :: forall k a. MonoidalMap k a -> MonoidalMap k a
deleteMax :: MonoidalMap k a -> MonoidalMap k a
deleteMax = (Map k a -> Map k a) -> MonoidalMap k a -> MonoidalMap k a
coerce (Map k a -> Map k a
forall k a. Map k a -> Map k a
M.deleteMax :: M.Map k a -> M.Map k a)
{-# INLINE deleteMax #-}

deleteFindMin :: forall k a. MonoidalMap k a -> ((k, a), MonoidalMap k a)
deleteFindMin :: MonoidalMap k a -> ((k, a), MonoidalMap k a)
deleteFindMin = (Map k a -> ((k, a), Map k a))
-> MonoidalMap k a -> ((k, a), MonoidalMap k a)
coerce (Map k a -> ((k, a), Map k a)
forall k a. Map k a -> ((k, a), Map k a)
M.deleteFindMin :: M.Map k a -> ((k, a), M.Map k a))
{-# INLINE deleteFindMin #-}

deleteFindMax :: forall k a. MonoidalMap k a -> ((k, a), MonoidalMap k a)
deleteFindMax :: MonoidalMap k a -> ((k, a), MonoidalMap k a)
deleteFindMax = (Map k a -> ((k, a), Map k a))
-> MonoidalMap k a -> ((k, a), MonoidalMap k a)
coerce (Map k a -> ((k, a), Map k a)
forall k a. Map k a -> ((k, a), Map k a)
M.deleteFindMax :: M.Map k a -> ((k, a), M.Map k a))
{-# INLINE deleteFindMax #-}

updateMin :: forall k a. (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
updateMin :: (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
updateMin = ((a -> Maybe a) -> Map k a -> Map k a)
-> (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
coerce ((a -> Maybe a) -> Map k a -> Map k a
forall a k. (a -> Maybe a) -> Map k a -> Map k a
M.updateMin :: (a -> Maybe a) -> M.Map k a -> M.Map k a)
{-# INLINE updateMin #-}

updateMax :: forall k a. (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
updateMax :: (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
updateMax = ((a -> Maybe a) -> Map k a -> Map k a)
-> (a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
coerce ((a -> Maybe a) -> Map k a -> Map k a
forall a k. (a -> Maybe a) -> Map k a -> Map k a
M.updateMax :: (a -> Maybe a) -> M.Map k a -> M.Map k a)
{-# INLINE updateMax #-}

updateMinWithKey :: forall k a. (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
updateMinWithKey :: (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
updateMinWithKey = ((k -> a -> Maybe a) -> Map k a -> Map k a)
-> (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
coerce ((k -> a -> Maybe a) -> Map k a -> Map k a
forall k a. (k -> a -> Maybe a) -> Map k a -> Map k a
M.updateMinWithKey :: (k -> a -> Maybe a) -> M.Map k a -> M.Map k a)
{-# INLINE updateMinWithKey #-}

updateMaxWithKey :: forall k a. (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
updateMaxWithKey :: (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
updateMaxWithKey = ((k -> a -> Maybe a) -> Map k a -> Map k a)
-> (k -> a -> Maybe a) -> MonoidalMap k a -> MonoidalMap k a
coerce ((k -> a -> Maybe a) -> Map k a -> Map k a
forall k a. (k -> a -> Maybe a) -> Map k a -> Map k a
M.updateMaxWithKey :: (k -> a -> Maybe a) -> M.Map k a -> M.Map k a)
{-# INLINE updateMaxWithKey #-}

minView :: forall k a. MonoidalMap k a -> Maybe (a, MonoidalMap k a)
minView :: MonoidalMap k a -> Maybe (a, MonoidalMap k a)
minView = (Map k a -> Maybe (a, Map k a))
-> MonoidalMap k a -> Maybe (a, MonoidalMap k a)
coerce (Map k a -> Maybe (a, Map k a)
forall k a. Map k a -> Maybe (a, Map k a)
M.minView :: M.Map k a -> Maybe (a, M.Map k a))
{-# INLINE minView #-}

maxView :: forall k a. MonoidalMap k a -> Maybe (a, MonoidalMap k a)
maxView :: MonoidalMap k a -> Maybe (a, MonoidalMap k a)
maxView = (Map k a -> Maybe (a, Map k a))
-> MonoidalMap k a -> Maybe (a, MonoidalMap k a)
coerce (Map k a -> Maybe (a, Map k a)
forall k a. Map k a -> Maybe (a, Map k a)
M.maxView :: M.Map k a -> Maybe (a, M.Map k a))
{-# INLINE maxView #-}

minViewWithKey :: forall k a. MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
minViewWithKey :: MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
minViewWithKey = (Map k a -> Maybe ((k, a), Map k a))
-> MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
coerce (Map k a -> Maybe ((k, a), Map k a)
forall k a. Map k a -> Maybe ((k, a), Map k a)
M.minViewWithKey :: M.Map k a -> Maybe ((k, a), M.Map k a))
{-# INLINE minViewWithKey #-}

maxViewWithKey :: forall k a. MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
maxViewWithKey :: MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
maxViewWithKey = (Map k a -> Maybe ((k, a), Map k a))
-> MonoidalMap k a -> Maybe ((k, a), MonoidalMap k a)
coerce (Map k a -> Maybe ((k, a), Map k a)
forall k a. Map k a -> Maybe ((k, a), Map k a)
M.maxViewWithKey :: M.Map k a -> Maybe ((k, a), M.Map k a))
{-# INLINE maxViewWithKey #-}

-- showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String
-- showTree = coerce (M.showTree :: (Show k, Show a) => M.Map k a -> String)
-- {-# INLINE showTree #-}

-- showTreeWith :: forall k a. (k -> a -> String) -> Bool -> Bool -> MonoidalMap k a -> String
-- showTreeWith = coerce (M.showTreeWith :: (k -> a -> String) -> Bool -> Bool -> M.Map k a -> String)
-- {-# INLINE showTreeWith #-}

valid :: forall k a. Ord k => MonoidalMap k a -> Bool
valid :: MonoidalMap k a -> Bool
valid = (Map k a -> Bool) -> MonoidalMap k a -> Bool
coerce (Ord k => Map k a -> Bool
forall k a. Ord k => Map k a -> Bool
M.valid :: Ord k => M.Map k a -> Bool)
{-# INLINE valid #-}