    {-# LANGUAGE CPP #-}
    -- |
    -- Module      :  $Header$
    -- Description :  Data.IntMap.Strict with Enum keys.
    -- Copyright   :  (c) 2011-2019 Michal Terepeta
    --                (c) 2019-2022 Mikolaj Konarski and others (see git history)
    -- License     :  BSD3
    -- Maintainer  :  mikolaj.konarski@funktory.com
    -- Stability   :  alpha
    -- Portability :  uses DeriveDataTypeable and GeneralizedNewtypeDeriving

    -- This is a simple wrapper for 'Data.IntMap.Strict' that works with any type of
    -- keys that are instances of 'Enum' type class.  For documentation please see
    -- the one for 'Data.IntMap'.

    module Data.EnumMap.Strict
      ( EnumMap

      -- * Wrapping/unwrapping
      , intMapToEnumMap
      , enumMapToIntMap

      -- * Operators
      , (!)
      , (\\)

      -- * Query
      , null
      , size
      , member
      , notMember
      , lookup
      , findWithDefault
      , lookupLT
      , lookupGT
      , lookupLE
      , lookupGE

      -- * Construction
      , empty
      , singleton

      -- ** Insertion
      , insert
      , insertWith
      , insertWithKey
      , insertLookupWithKey

      -- ** Delete\/Update
      , delete
      , adjust
      , adjustWithKey
      , update
      , updateWithKey
      , updateLookupWithKey
      , alter
      , alterF

      -- * Combine

      -- ** Union
      , union
      , unionWith
      , unionWithKey
      , unions
      , unionsWith

      -- ** Difference
      , difference
      , differenceWith
      , differenceWithKey

      -- ** Intersection
      , intersection
      , intersectionWith
      , intersectionWithKey

      -- ** Universal combining function
      , mergeWithKey

      -- * Traversal
      -- ** Map
      , map
      , mapWithKey
      , traverseWithKey
      , mapAccum
      , mapAccumWithKey
      , mapAccumRWithKey
      , mapKeys
      , mapKeysWith
      , mapKeysMonotonic

      -- * Folds
      , foldr
      , foldl
      , foldrWithKey
      , foldlWithKey
      -- ** Strict folds
      , foldr'
      , foldl'
      , foldrWithKey'
      , foldlWithKey'

      -- * Conversion
      , elems
      , keys
      , assocs
      , keysSet
      , fromSet

      -- ** Lists
      , toList
      , fromList
      , fromListWith
      , fromListWithKey

      -- ** Ordered lists
      , toAscList
      , toDescList
      , fromAscList
      , fromAscListWith
      , fromAscListWithKey
      , fromDistinctAscList

      -- * Filter
      , filter
      , filterWithKey
    #if (MIN_VERSION_containers(0,5,8))
      , restrictKeys
      , withoutKeys
    #endif
      , partition
      , partitionWithKey

      , mapMaybe
      , mapMaybeWithKey
      , mapEither
      , mapEitherWithKey

      , split
      , splitLookup

      -- * Submap
      , isSubmapOf
      , isSubmapOfBy
      , isProperSubmapOf
      , isProperSubmapOfBy

      -- * Min\/Max
      , lookupMin
      , lookupMax
      , findMin
      , findMax
      , deleteMin
      , deleteMax
      , deleteFindMin
      , deleteFindMax
      , updateMin
      , updateMax
      , updateMinWithKey
      , updateMaxWithKey
      , minView
      , maxView
      , minViewWithKey
      , maxViewWithKey
      ) where

    import           Prelude hiding (Foldable(..), filter, lookup, map)
    import qualified Prelude as P

    import Control.Arrow (first, second, (***))

    import qualified Data.IntMap.Strict as I

    import           Data.EnumSet (EnumSet)
    import qualified Data.EnumSet as EnumSet

    import Data.EnumMap.Base hiding (adjust, adjustWithKey, alter, alterF, differenceWith,
                              differenceWithKey, findWithDefault, fromAscList,
                              fromAscListWith, fromAscListWithKey,
                              fromDistinctAscList, fromList, fromListWith,
                              fromListWithKey, fromSet, insert, insertLookupWithKey,
                              insertWith, insertWithKey, intersectionWith,
                              intersectionWithKey, map, mapAccum, mapAccumRWithKey,
                              mapAccumWithKey, mapEither, mapEitherWithKey,
                              mapKeysWith, mapMaybe, mapMaybeWithKey, mapWithKey,
                              mergeWithKey, singleton, unionWith, unionWithKey,
                              unionsWith, update, updateLookupWithKey, updateMax,
                              updateMaxWithKey, updateMin, updateMinWithKey,
                              updateWithKey)

    findWithDefault :: (Enum k) => a -> k -> EnumMap k a -> a
    findWithDefault :: forall k a. Enum k => a -> k -> EnumMap k a -> a
    findWithDefault a
    def k
    k = a -> Key -> IntMap a -> a
    forall a. a -> Key -> IntMap a -> a
    I.findWithDefault a
    def (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) (IntMap a -> a) -> (EnumMap k a -> IntMap a) -> EnumMap k a -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE findWithDefault #-}

    singleton :: (Enum k) => k -> a -> EnumMap k a
    singleton :: forall k a. Enum k => k -> a -> EnumMap k a
    singleton k
    k = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a) -> (a -> IntMap a) -> a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> a -> IntMap a
    forall a. Key -> a -> IntMap a
    I.singleton (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k)
    {-# INLINE singleton #-}

    insert :: (Enum k) => k -> a -> EnumMap k a -> EnumMap k a
    insert :: forall k a. Enum k => k -> a -> EnumMap k a -> EnumMap k a
    insert k
    k a
    a = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> a -> IntMap a -> IntMap a
    forall a. Key -> a -> IntMap a -> IntMap a
    I.insert (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) a
    a (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE insert #-}

    insertWith :: (Enum k) => (a -> a -> a) -> k -> a -> EnumMap k a -> EnumMap k a
    insertWith :: forall k a.
    Enum k =>
    (a -> a -> a) -> k -> a -> EnumMap k a -> EnumMap k a
    insertWith a -> a -> a
    f k
    k a
    a = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
    forall a. (a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
    I.insertWith a -> a -> a
    f (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) a
    a (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE insertWith #-}

    insertWithKey :: (Enum k)
      => (k -> a -> a -> a) -> k -> a -> EnumMap k a -> EnumMap k a
    insertWithKey :: forall k a.
    Enum k =>
    (k -> a -> a -> a) -> k -> a -> EnumMap k a -> EnumMap k a
    insertWithKey k -> a -> a -> a
    f k
    k a
    a =
      IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
    forall a. (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
    I.insertWithKey (k -> a -> a -> a
    f (k -> a -> a -> a) -> (Key -> k) -> Key -> a -> a -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) a
    a (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE insertWithKey #-}

    insertLookupWithKey :: (Enum k)
      => (k -> a -> a -> a) -> k -> a -> EnumMap k a -> (Maybe a, EnumMap k a)
    insertLookupWithKey :: forall k a.
    Enum k =>
    (k -> a -> a -> a)
    -> k -> a -> EnumMap k a -> (Maybe a, EnumMap k a)
    insertLookupWithKey k -> a -> a -> a
    f k
    k a
    a =
      (IntMap a -> EnumMap k a)
    -> (Maybe a, IntMap a) -> (Maybe a, EnumMap k a)
    forall b c d. (b -> c) -> (d, b) -> (d, c)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (d, b) (d, c)
    second IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap ((Maybe a, IntMap a) -> (Maybe a, EnumMap k a))
    -> (EnumMap k a -> (Maybe a, IntMap a))
    -> EnumMap k a
    -> (Maybe a, EnumMap k a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> a -> a) -> Key -> a -> IntMap a -> (Maybe a, IntMap a)
    forall a.
    (Key -> a -> a -> a) -> Key -> a -> IntMap a -> (Maybe a, IntMap a)
    I.insertLookupWithKey (k -> a -> a -> a
    f (k -> a -> a -> a) -> (Key -> k) -> Key -> a -> a -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) a
    a (IntMap a -> (Maybe a, IntMap a))
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> (Maybe a, IntMap a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE insertLookupWithKey #-}

    adjust ::  (Enum k) => (a -> a) -> k -> EnumMap k a -> EnumMap k a
    adjust :: forall k a. Enum k => (a -> a) -> k -> EnumMap k a -> EnumMap k a
    adjust a -> a
    f k
    k = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> a) -> Key -> IntMap a -> IntMap a
    forall a. (a -> a) -> Key -> IntMap a -> IntMap a
    I.adjust a -> a
    f (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE adjust #-}

    adjustWithKey :: (Enum k) => (k -> a -> a) -> k -> EnumMap k a -> EnumMap k a
    adjustWithKey :: forall k a.
    Enum k =>
    (k -> a -> a) -> k -> EnumMap k a -> EnumMap k a
    adjustWithKey k -> a -> a
    f k
    k = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> a) -> Key -> IntMap a -> IntMap a
    forall a. (Key -> a -> a) -> Key -> IntMap a -> IntMap a
    I.adjustWithKey (k -> a -> a
    f (k -> a -> a) -> (Key -> k) -> Key -> a -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE adjustWithKey #-}

    alter :: (Enum k) => (Maybe a -> Maybe a) -> k -> EnumMap k a -> EnumMap k a
    alter :: forall k a.
    Enum k =>
    (Maybe a -> Maybe a) -> k -> EnumMap k a -> EnumMap k a
    alter Maybe a -> Maybe a
    f k
    k = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Maybe a -> Maybe a) -> Key -> IntMap a -> IntMap a
    forall a. (Maybe a -> Maybe a) -> Key -> IntMap a -> IntMap a
    I.alter Maybe a -> Maybe a
    f (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE alter #-}

    alterF :: (Enum k, Functor f) => (Maybe a -> f (Maybe a)) -> k -> EnumMap k a -> f (EnumMap k a)
    alterF :: forall k (f :: * -> *) a.
    (Enum k, Functor f) =>
    (Maybe a -> f (Maybe a)) -> k -> EnumMap k a -> f (EnumMap k a)
    alterF Maybe a -> f (Maybe a)
    f k
    k = (IntMap a -> EnumMap k a) -> f (IntMap a) -> f (EnumMap k a)
    forall a b. (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (f (IntMap a) -> f (EnumMap k a))
    -> (EnumMap k a -> f (IntMap a)) -> EnumMap k a -> f (EnumMap k a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Maybe a -> f (Maybe a)) -> Key -> IntMap a -> f (IntMap a)
    forall (f :: * -> *) a.
    Functor f =>
    (Maybe a -> f (Maybe a)) -> Key -> IntMap a -> f (IntMap a)
    I.alterF Maybe a -> f (Maybe a)
    f (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) (IntMap a -> f (IntMap a))
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> f (IntMap a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE alterF #-}

    unionsWith :: (a -> a -> a) -> [EnumMap k a] -> EnumMap k a
    unionsWith :: forall a k. (a -> a -> a) -> [EnumMap k a] -> EnumMap k a
    unionsWith a -> a -> a
    f = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> ([EnumMap k a] -> IntMap a) -> [EnumMap k a] -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> a -> a) -> [IntMap a] -> IntMap a
    forall (f :: * -> *) a.
    Foldable f =>
    (a -> a -> a) -> f (IntMap a) -> IntMap a
    I.unionsWith a -> a -> a
    f ([IntMap a] -> IntMap a)
    -> ([EnumMap k a] -> [IntMap a]) -> [EnumMap k a] -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (EnumMap k a -> IntMap a) -> [EnumMap k a] -> [IntMap a]
    forall a b. (a -> b) -> [a] -> [b]
    P.map EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE unionsWith #-}

    unionWith :: (a -> a -> a) -> EnumMap k a -> EnumMap k a -> EnumMap k a
    unionWith :: forall a k.
    (a -> a -> a) -> EnumMap k a -> EnumMap k a -> EnumMap k a
    unionWith a -> a -> a
    f (EnumMap IntMap a
    im1) (EnumMap IntMap a
    im2) = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a) -> IntMap a -> EnumMap k a
    forall a b. (a -> b) -> a -> b
    $ (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
    forall a. (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
    I.unionWith a -> a -> a
    f IntMap a
    im1 IntMap a
    im2
    {-# INLINE unionWith #-}

    unionWithKey :: (Enum k)
      => (k -> a -> a -> a) -> EnumMap k a -> EnumMap k a -> EnumMap k a
    unionWithKey :: forall k a.
    Enum k =>
    (k -> a -> a -> a) -> EnumMap k a -> EnumMap k a -> EnumMap k a
    unionWithKey k -> a -> a -> a
    f (EnumMap IntMap a
    im1) (EnumMap IntMap a
    im2) =
      IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a) -> IntMap a -> EnumMap k a
    forall a b. (a -> b) -> a -> b
    $ (Key -> a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
    forall a. (Key -> a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
    I.unionWithKey (k -> a -> a -> a
    f (k -> a -> a -> a) -> (Key -> k) -> Key -> a -> a -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) IntMap a
    im1 IntMap a
    im2
    {-# INLINE unionWithKey #-}

    differenceWith :: (a -> b -> Maybe a) -> EnumMap k a -> EnumMap k b -> EnumMap k a
    differenceWith :: forall a b k.
    (a -> b -> Maybe a) -> EnumMap k a -> EnumMap k b -> EnumMap k a
    differenceWith a -> b -> Maybe a
    f (EnumMap IntMap a
    im1) (EnumMap IntMap b
    im2) =
      IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a) -> IntMap a -> EnumMap k a
    forall a b. (a -> b) -> a -> b
    $ (a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
    forall a b. (a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
    I.differenceWith a -> b -> Maybe a
    f IntMap a
    im1 IntMap b
    im2
    {-# INLINE differenceWith #-}

    differenceWithKey :: (Enum k)
      => (k -> a -> b -> Maybe a) -> EnumMap k a -> EnumMap k b -> EnumMap k a
    differenceWithKey :: forall k a b.
    Enum k =>
    (k -> a -> b -> Maybe a)
    -> EnumMap k a -> EnumMap k b -> EnumMap k a
    differenceWithKey k -> a -> b -> Maybe a
    f (EnumMap IntMap a
    im1) (EnumMap IntMap b
    im2) =
      IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a) -> IntMap a -> EnumMap k a
    forall a b. (a -> b) -> a -> b
    $ (Key -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
    forall a b.
    (Key -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
    I.differenceWithKey (k -> a -> b -> Maybe a
    f (k -> a -> b -> Maybe a) -> (Key -> k) -> Key -> a -> b -> Maybe a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) IntMap a
    im1 IntMap b
    im2
    {-# INLINE differenceWithKey #-}

    intersectionWith :: (a -> b -> c) -> EnumMap k a -> EnumMap k b -> EnumMap k c
    intersectionWith :: forall a b c k.
    (a -> b -> c) -> EnumMap k a -> EnumMap k b -> EnumMap k c
    intersectionWith a -> b -> c
    f (EnumMap IntMap a
    im1) (EnumMap IntMap b
    im2) =
      IntMap c -> EnumMap k c
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap c -> EnumMap k c) -> IntMap c -> EnumMap k c
    forall a b. (a -> b) -> a -> b
    $ (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
    forall a b c. (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
    I.intersectionWith a -> b -> c
    f IntMap a
    im1 IntMap b
    im2
    {-# INLINE intersectionWith #-}

    intersectionWithKey :: (Enum k)
      => (k -> a -> b -> c) -> EnumMap k a -> EnumMap k b -> EnumMap k c
    intersectionWithKey :: forall k a b c.
    Enum k =>
    (k -> a -> b -> c) -> EnumMap k a -> EnumMap k b -> EnumMap k c
    intersectionWithKey k -> a -> b -> c
    f (EnumMap IntMap a
    im1) (EnumMap IntMap b
    im2) =
      IntMap c -> EnumMap k c
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap c -> EnumMap k c) -> IntMap c -> EnumMap k c
    forall a b. (a -> b) -> a -> b
    $ (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
    forall a b c.
    (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
    I.intersectionWithKey (k -> a -> b -> c
    f (k -> a -> b -> c) -> (Key -> k) -> Key -> a -> b -> c
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) IntMap a
    im1 IntMap b
    im2
    {-# INLINE intersectionWithKey #-}

    mergeWithKey :: (Enum k)
      => (k -> a -> b -> Maybe c)
      -> (EnumMap k a -> EnumMap k c)
      -> (EnumMap k b -> EnumMap k c)
      -> EnumMap k a
      -> EnumMap k b
      -> EnumMap k c
    mergeWithKey :: forall k a b c.
    Enum k =>
    (k -> a -> b -> Maybe c)
    -> (EnumMap k a -> EnumMap k c)
    -> (EnumMap k b -> EnumMap k c)
    -> EnumMap k a
    -> EnumMap k b
    -> EnumMap k c
    mergeWithKey k -> a -> b -> Maybe c
    f EnumMap k a -> EnumMap k c
    ga EnumMap k b -> EnumMap k c
    gb = \EnumMap k a
    ma EnumMap k b
    mb -> IntMap c -> EnumMap k c
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap c -> EnumMap k c) -> IntMap c -> EnumMap k c
    forall a b. (a -> b) -> a -> b
    $
      (Key -> a -> b -> Maybe c)
    -> (IntMap a -> IntMap c)
    -> (IntMap b -> IntMap c)
    -> IntMap a
    -> IntMap b
    -> IntMap c
    forall a b c.
    (Key -> a -> b -> Maybe c)
    -> (IntMap a -> IntMap c)
    -> (IntMap b -> IntMap c)
    -> IntMap a
    -> IntMap b
    -> IntMap c
    I.mergeWithKey (k -> a -> b -> Maybe c
    f (k -> a -> b -> Maybe c) -> (Key -> k) -> Key -> a -> b -> Maybe c
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum)
                     (EnumMap k c -> IntMap c
    forall k a. EnumMap k a -> IntMap a
    unWrap (EnumMap k c -> IntMap c)
    -> (IntMap a -> EnumMap k c) -> IntMap a -> IntMap c
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> EnumMap k c
    ga (EnumMap k a -> EnumMap k c)
    -> (IntMap a -> EnumMap k a) -> IntMap a -> EnumMap k c
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap)
                     (EnumMap k c -> IntMap c
    forall k a. EnumMap k a -> IntMap a
    unWrap (EnumMap k c -> IntMap c)
    -> (IntMap b -> EnumMap k c) -> IntMap b -> IntMap c
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k b -> EnumMap k c
    gb (EnumMap k b -> EnumMap k c)
    -> (IntMap b -> EnumMap k b) -> IntMap b -> EnumMap k c
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntMap b -> EnumMap k b
    forall k a. IntMap a -> EnumMap k a
    EnumMap)
                     (EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap EnumMap k a
    ma)
                     (EnumMap k b -> IntMap b
    forall k a. EnumMap k a -> IntMap a
    unWrap EnumMap k b
    mb)
    {-# INLINE mergeWithKey #-}

    update ::  (Enum k) => (a -> Maybe a) -> k -> EnumMap k a -> EnumMap k a
    update :: forall k a.
    Enum k =>
    (a -> Maybe a) -> k -> EnumMap k a -> EnumMap k a
    update a -> Maybe a
    f k
    k = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> Maybe a) -> Key -> IntMap a -> IntMap a
    forall a. (a -> Maybe a) -> Key -> IntMap a -> IntMap a
    I.update a -> Maybe a
    f (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE update #-}

    updateWithKey ::  (Enum k)
      => (k -> a -> Maybe a) -> k -> EnumMap k a -> EnumMap k a
    updateWithKey :: forall k a.
    Enum k =>
    (k -> a -> Maybe a) -> k -> EnumMap k a -> EnumMap k a
    updateWithKey k -> a -> Maybe a
    f k
    k = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> Maybe a) -> Key -> IntMap a -> IntMap a
    forall a. (Key -> a -> Maybe a) -> Key -> IntMap a -> IntMap a
    I.updateWithKey (k -> a -> Maybe a
    f (k -> a -> Maybe a) -> (Key -> k) -> Key -> a -> Maybe a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE updateWithKey #-}

    updateLookupWithKey ::  (Enum k)
      => (k -> a -> Maybe a) -> k -> EnumMap k a -> (Maybe a,EnumMap k a)
    updateLookupWithKey :: forall k a.
    Enum k =>
    (k -> a -> Maybe a) -> k -> EnumMap k a -> (Maybe a, EnumMap k a)
    updateLookupWithKey k -> a -> Maybe a
    f k
    k =
      (IntMap a -> EnumMap k a)
    -> (Maybe a, IntMap a) -> (Maybe a, EnumMap k a)
    forall b c d. (b -> c) -> (d, b) -> (d, c)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (d, b) (d, c)
    second IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap ((Maybe a, IntMap a) -> (Maybe a, EnumMap k a))
    -> (EnumMap k a -> (Maybe a, IntMap a))
    -> EnumMap k a
    -> (Maybe a, EnumMap k a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> Maybe a) -> Key -> IntMap a -> (Maybe a, IntMap a)
    forall a.
    (Key -> a -> Maybe a) -> Key -> IntMap a -> (Maybe a, IntMap a)
    I.updateLookupWithKey (k -> a -> Maybe a
    f (k -> a -> Maybe a) -> (Key -> k) -> Key -> a -> Maybe a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (k -> Key
    forall a. Enum a => a -> Key
    fromEnum k
    k) (IntMap a -> (Maybe a, IntMap a))
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> (Maybe a, IntMap a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE updateLookupWithKey #-}

    updateMinWithKey :: (Enum k) => (k -> a -> Maybe a) -> EnumMap k a -> EnumMap k a
    updateMinWithKey :: forall k a.
    Enum k =>
    (k -> a -> Maybe a) -> EnumMap k a -> EnumMap k a
    updateMinWithKey k -> a -> Maybe a
    f = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> Maybe a) -> IntMap a -> IntMap a
    forall a. (Key -> a -> Maybe a) -> IntMap a -> IntMap a
    I.updateMinWithKey (k -> a -> Maybe a
    f (k -> a -> Maybe a) -> (Key -> k) -> Key -> a -> Maybe a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE updateMinWithKey #-}

    updateMaxWithKey :: (Enum k) => (k -> a -> Maybe a) -> EnumMap k a -> EnumMap k a
    updateMaxWithKey :: forall k a.
    Enum k =>
    (k -> a -> Maybe a) -> EnumMap k a -> EnumMap k a
    updateMaxWithKey k -> a -> Maybe a
    f = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> Maybe a) -> IntMap a -> IntMap a
    forall a. (Key -> a -> Maybe a) -> IntMap a -> IntMap a
    I.updateMaxWithKey (k -> a -> Maybe a
    f (k -> a -> Maybe a) -> (Key -> k) -> Key -> a -> Maybe a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE updateMaxWithKey #-}

    updateMax :: (a -> Maybe a) -> EnumMap k a -> EnumMap k a
    updateMax :: forall a k. (a -> Maybe a) -> EnumMap k a -> EnumMap k a
    updateMax a -> Maybe a
    f = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> Maybe a) -> IntMap a -> IntMap a
    forall a. (a -> Maybe a) -> IntMap a -> IntMap a
    I.updateMax a -> Maybe a
    f (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE updateMax #-}

    updateMin :: (a -> Maybe a) -> EnumMap k a -> EnumMap k a
    updateMin :: forall a k. (a -> Maybe a) -> EnumMap k a -> EnumMap k a
    updateMin a -> Maybe a
    f = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> Maybe a) -> IntMap a -> IntMap a
    forall a. (a -> Maybe a) -> IntMap a -> IntMap a
    I.updateMin a -> Maybe a
    f (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE updateMin #-}

    map :: (a -> b) -> EnumMap k a -> EnumMap k b
    map :: forall a b k. (a -> b) -> EnumMap k a -> EnumMap k b
    map a -> b
    f = IntMap b -> EnumMap k b
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap b -> EnumMap k b)
    -> (EnumMap k a -> IntMap b) -> EnumMap k a -> EnumMap k b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> b) -> IntMap a -> IntMap b
    forall a b. (a -> b) -> IntMap a -> IntMap b
    I.map a -> b
    f (IntMap a -> IntMap b)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE map #-}

    mapWithKey :: (Enum k) => (k -> a -> b) -> EnumMap k a -> EnumMap k b
    mapWithKey :: forall k a b. Enum k => (k -> a -> b) -> EnumMap k a -> EnumMap k b
    mapWithKey k -> a -> b
    f = IntMap b -> EnumMap k b
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap b -> EnumMap k b)
    -> (EnumMap k a -> IntMap b) -> EnumMap k a -> EnumMap k b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> b) -> IntMap a -> IntMap b
    forall a b. (Key -> a -> b) -> IntMap a -> IntMap b
    I.mapWithKey (k -> a -> b
    f (k -> a -> b) -> (Key -> k) -> Key -> a -> b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (IntMap a -> IntMap b)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE mapWithKey #-}

    mapAccum :: (a -> b -> (a, c)) -> a -> EnumMap k b -> (a, EnumMap k c)
    mapAccum :: forall a b c k.
    (a -> b -> (a, c)) -> a -> EnumMap k b -> (a, EnumMap k c)
    mapAccum a -> b -> (a, c)
    f a
    a = (IntMap c -> EnumMap k c) -> (a, IntMap c) -> (a, EnumMap k c)
    forall b c d. (b -> c) -> (d, b) -> (d, c)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (d, b) (d, c)
    second IntMap c -> EnumMap k c
    forall k a. IntMap a -> EnumMap k a
    EnumMap ((a, IntMap c) -> (a, EnumMap k c))
    -> (EnumMap k b -> (a, IntMap c))
    -> EnumMap k b
    -> (a, EnumMap k c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
    forall a b c. (a -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
    I.mapAccum a -> b -> (a, c)
    f a
    a (IntMap b -> (a, IntMap c))
    -> (EnumMap k b -> IntMap b) -> EnumMap k b -> (a, IntMap c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k b -> IntMap b
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE mapAccum #-}

    mapAccumWithKey :: (Enum k)
      => (a -> k -> b -> (a, c)) -> a -> EnumMap k b -> (a, EnumMap k c)
    mapAccumWithKey :: forall k a b c.
    Enum k =>
    (a -> k -> b -> (a, c)) -> a -> EnumMap k b -> (a, EnumMap k c)
    mapAccumWithKey a -> k -> b -> (a, c)
    f a
    a =
      (IntMap c -> EnumMap k c) -> (a, IntMap c) -> (a, EnumMap k c)
    forall b c d. (b -> c) -> (d, b) -> (d, c)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (d, b) (d, c)
    second IntMap c -> EnumMap k c
    forall k a. IntMap a -> EnumMap k a
    EnumMap ((a, IntMap c) -> (a, EnumMap k c))
    -> (EnumMap k b -> (a, IntMap c))
    -> EnumMap k b
    -> (a, EnumMap k c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> Key -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
    forall a b c.
    (a -> Key -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
    I.mapAccumWithKey (\a
    b -> a -> k -> b -> (a, c)
    f a
    b (k -> b -> (a, c)) -> (Key -> k) -> Key -> b -> (a, c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) a
    a (IntMap b -> (a, IntMap c))
    -> (EnumMap k b -> IntMap b) -> EnumMap k b -> (a, IntMap c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k b -> IntMap b
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE mapAccumWithKey #-}

    mapAccumRWithKey :: (Enum k)
      => (a -> k -> b -> (a, c)) -> a -> EnumMap k b -> (a, EnumMap k c)
    mapAccumRWithKey :: forall k a b c.
    Enum k =>
    (a -> k -> b -> (a, c)) -> a -> EnumMap k b -> (a, EnumMap k c)
    mapAccumRWithKey a -> k -> b -> (a, c)
    f a
    a =
      (IntMap c -> EnumMap k c) -> (a, IntMap c) -> (a, EnumMap k c)
    forall b c d. (b -> c) -> (d, b) -> (d, c)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (d, b) (d, c)
    second IntMap c -> EnumMap k c
    forall k a. IntMap a -> EnumMap k a
    EnumMap ((a, IntMap c) -> (a, EnumMap k c))
    -> (EnumMap k b -> (a, IntMap c))
    -> EnumMap k b
    -> (a, EnumMap k c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> Key -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
    forall a b c.
    (a -> Key -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
    I.mapAccumRWithKey (\a
    b -> a -> k -> b -> (a, c)
    f a
    b (k -> b -> (a, c)) -> (Key -> k) -> Key -> b -> (a, c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) a
    a (IntMap b -> (a, IntMap c))
    -> (EnumMap k b -> IntMap b) -> EnumMap k b -> (a, IntMap c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k b -> IntMap b
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE mapAccumRWithKey #-}

    mapKeysWith :: (Enum k) => (a -> a -> a) -> (k -> k) -> EnumMap k a -> EnumMap k a
    mapKeysWith :: forall k a.
    Enum k =>
    (a -> a -> a) -> (k -> k) -> EnumMap k a -> EnumMap k a
    mapKeysWith a -> a -> a
    f k -> k
    g = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> a -> a) -> (Key -> Key) -> IntMap a -> IntMap a
    forall a. (a -> a -> a) -> (Key -> Key) -> IntMap a -> IntMap a
    I.mapKeysWith a -> a -> a
    f (k -> Key
    forall a. Enum a => a -> Key
    fromEnum (k -> Key) -> (Key -> k) -> Key -> Key
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . k -> k
    g (k -> k) -> (Key -> k) -> Key -> k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (IntMap a -> IntMap a)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE mapKeysWith #-}

    mapMaybe :: (a -> Maybe b) -> EnumMap k a -> EnumMap k b
    mapMaybe :: forall a b k. (a -> Maybe b) -> EnumMap k a -> EnumMap k b
    mapMaybe a -> Maybe b
    f = IntMap b -> EnumMap k b
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap b -> EnumMap k b)
    -> (EnumMap k a -> IntMap b) -> EnumMap k a -> EnumMap k b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> Maybe b) -> IntMap a -> IntMap b
    forall a b. (a -> Maybe b) -> IntMap a -> IntMap b
    I.mapMaybe a -> Maybe b
    f (IntMap a -> IntMap b)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE mapMaybe #-}

    mapMaybeWithKey :: (Enum k) => (k -> a -> Maybe b) -> EnumMap k a -> EnumMap k b
    mapMaybeWithKey :: forall k a b.
    Enum k =>
    (k -> a -> Maybe b) -> EnumMap k a -> EnumMap k b
    mapMaybeWithKey k -> a -> Maybe b
    f = IntMap b -> EnumMap k b
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap b -> EnumMap k b)
    -> (EnumMap k a -> IntMap b) -> EnumMap k a -> EnumMap k b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> Maybe b) -> IntMap a -> IntMap b
    forall a b. (Key -> a -> Maybe b) -> IntMap a -> IntMap b
    I.mapMaybeWithKey (k -> a -> Maybe b
    f (k -> a -> Maybe b) -> (Key -> k) -> Key -> a -> Maybe b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (IntMap a -> IntMap b)
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> IntMap b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE mapMaybeWithKey #-}

    mapEither :: (a -> Either b c) -> EnumMap k a -> (EnumMap k b, EnumMap k c)
    mapEither :: forall a b c k.
    (a -> Either b c) -> EnumMap k a -> (EnumMap k b, EnumMap k c)
    mapEither a -> Either b c
    f = (IntMap b -> EnumMap k b
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap b -> EnumMap k b)
    -> (IntMap c -> EnumMap k c)
    -> (IntMap b, IntMap c)
    -> (EnumMap k b, EnumMap k c)
    forall b c b' c'. (b -> c) -> (b' -> c') -> (b, b') -> (c, c')
    forall (a :: * -> * -> *) b c b' c'.
    Arrow a =>
    a b c -> a b' c' -> a (b, b') (c, c')
    *** IntMap c -> EnumMap k c
    forall k a. IntMap a -> EnumMap k a
    EnumMap) ((IntMap b, IntMap c) -> (EnumMap k b, EnumMap k c))
    -> (EnumMap k a -> (IntMap b, IntMap c))
    -> EnumMap k a
    -> (EnumMap k b, EnumMap k c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
    forall a b c. (a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
    I.mapEither a -> Either b c
    f (IntMap a -> (IntMap b, IntMap c))
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> (IntMap b, IntMap c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE mapEither #-}

    mapEitherWithKey :: (Enum k)
      => (k -> a -> Either b c) -> EnumMap k a -> (EnumMap k b, EnumMap k c)
    mapEitherWithKey :: forall k a b c.
    Enum k =>
    (k -> a -> Either b c) -> EnumMap k a -> (EnumMap k b, EnumMap k c)
    mapEitherWithKey k -> a -> Either b c
    f =
      (IntMap b -> EnumMap k b
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap b -> EnumMap k b)
    -> (IntMap c -> EnumMap k c)
    -> (IntMap b, IntMap c)
    -> (EnumMap k b, EnumMap k c)
    forall b c b' c'. (b -> c) -> (b' -> c') -> (b, b') -> (c, c')
    forall (a :: * -> * -> *) b c b' c'.
    Arrow a =>
    a b c -> a b' c' -> a (b, b') (c, c')
    *** IntMap c -> EnumMap k c
    forall k a. IntMap a -> EnumMap k a
    EnumMap) ((IntMap b, IntMap c) -> (EnumMap k b, EnumMap k c))
    -> (EnumMap k a -> (IntMap b, IntMap c))
    -> EnumMap k a
    -> (EnumMap k b, EnumMap k c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
    forall a b c.
    (Key -> a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
    I.mapEitherWithKey (k -> a -> Either b c
    f (k -> a -> Either b c) -> (Key -> k) -> Key -> a -> Either b c
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (IntMap a -> (IntMap b, IntMap c))
    -> (EnumMap k a -> IntMap a) -> EnumMap k a -> (IntMap b, IntMap c)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumMap k a -> IntMap a
    forall k a. EnumMap k a -> IntMap a
    unWrap
    {-# INLINE mapEitherWithKey #-}

    fromSet :: (Enum k) => (k -> a) -> EnumSet k -> EnumMap k a
    fromSet :: forall k a. Enum k => (k -> a) -> EnumSet k -> EnumMap k a
    fromSet k -> a
    f = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> (EnumSet k -> IntMap a) -> EnumSet k -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a) -> IntSet -> IntMap a
    forall a. (Key -> a) -> IntSet -> IntMap a
    I.fromSet (k -> a
    f (k -> a) -> (Key -> k) -> Key -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) (IntSet -> IntMap a)
    -> (EnumSet k -> IntSet) -> EnumSet k -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    EnumSet.enumSetToIntSet
    {-# INLINE fromSet #-}

    fromList :: (Enum k) => [(k, a)] -> EnumMap k a
    fromList :: forall k a. Enum k => [(k, a)] -> EnumMap k a
    fromList = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> ([(k, a)] -> IntMap a) -> [(k, a)] -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [(Key, a)] -> IntMap a
    forall a. [(Key, a)] -> IntMap a
    I.fromList ([(Key, a)] -> IntMap a)
    -> ([(k, a)] -> [(Key, a)]) -> [(k, a)] -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((k, a) -> (Key, a)) -> [(k, a)] -> [(Key, a)]
    forall a b. (a -> b) -> [a] -> [b]
    P.map ((k -> Key) -> (k, a) -> (Key, a)
    forall b c d. (b -> c) -> (b, d) -> (c, d)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (b, d) (c, d)
    first k -> Key
    forall a. Enum a => a -> Key
    fromEnum)
    {-# INLINE fromList #-}

    fromListWith :: (Enum k) => (a -> a -> a) -> [(k, a)] -> EnumMap k a
    fromListWith :: forall k a. Enum k => (a -> a -> a) -> [(k, a)] -> EnumMap k a
    fromListWith a -> a -> a
    f = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> ([(k, a)] -> IntMap a) -> [(k, a)] -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> a -> a) -> [(Key, a)] -> IntMap a
    forall a. (a -> a -> a) -> [(Key, a)] -> IntMap a
    I.fromListWith a -> a -> a
    f ([(Key, a)] -> IntMap a)
    -> ([(k, a)] -> [(Key, a)]) -> [(k, a)] -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((k, a) -> (Key, a)) -> [(k, a)] -> [(Key, a)]
    forall a b. (a -> b) -> [a] -> [b]
    P.map ((k -> Key) -> (k, a) -> (Key, a)
    forall b c d. (b -> c) -> (b, d) -> (c, d)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (b, d) (c, d)
    first k -> Key
    forall a. Enum a => a -> Key
    fromEnum)
    {-# INLINE fromListWith #-}

    fromListWithKey :: (Enum k) => (k -> a -> a -> a) -> [(k, a)] -> EnumMap k a
    fromListWithKey :: forall k a. Enum k => (k -> a -> a -> a) -> [(k, a)] -> EnumMap k a
    fromListWithKey k -> a -> a -> a
    f =
      IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> ([(k, a)] -> IntMap a) -> [(k, a)] -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> a -> a) -> [(Key, a)] -> IntMap a
    forall a. (Key -> a -> a -> a) -> [(Key, a)] -> IntMap a
    I.fromListWithKey (k -> a -> a -> a
    f (k -> a -> a -> a) -> (Key -> k) -> Key -> a -> a -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) ([(Key, a)] -> IntMap a)
    -> ([(k, a)] -> [(Key, a)]) -> [(k, a)] -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((k, a) -> (Key, a)) -> [(k, a)] -> [(Key, a)]
    forall a b. (a -> b) -> [a] -> [b]
    P.map ((k -> Key) -> (k, a) -> (Key, a)
    forall b c d. (b -> c) -> (b, d) -> (c, d)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (b, d) (c, d)
    first k -> Key
    forall a. Enum a => a -> Key
    fromEnum)
    {-# INLINE fromListWithKey #-}

    fromAscList :: (Enum k) => [(k, a)] -> EnumMap k a
    fromAscList :: forall k a. Enum k => [(k, a)] -> EnumMap k a
    fromAscList = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> ([(k, a)] -> IntMap a) -> [(k, a)] -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [(Key, a)] -> IntMap a
    forall a. [(Key, a)] -> IntMap a
    I.fromAscList ([(Key, a)] -> IntMap a)
    -> ([(k, a)] -> [(Key, a)]) -> [(k, a)] -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((k, a) -> (Key, a)) -> [(k, a)] -> [(Key, a)]
    forall a b. (a -> b) -> [a] -> [b]
    P.map ((k -> Key) -> (k, a) -> (Key, a)
    forall b c d. (b -> c) -> (b, d) -> (c, d)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (b, d) (c, d)
    first k -> Key
    forall a. Enum a => a -> Key
    fromEnum)
    {-# INLINE fromAscList #-}

    fromAscListWith :: (Enum k) => (a -> a -> a) -> [(k, a)] -> EnumMap k a
    fromAscListWith :: forall k a. Enum k => (a -> a -> a) -> [(k, a)] -> EnumMap k a
    fromAscListWith a -> a -> a
    f = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> ([(k, a)] -> IntMap a) -> [(k, a)] -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> a -> a) -> [(Key, a)] -> IntMap a
    forall a. (a -> a -> a) -> [(Key, a)] -> IntMap a
    I.fromAscListWith a -> a -> a
    f ([(Key, a)] -> IntMap a)
    -> ([(k, a)] -> [(Key, a)]) -> [(k, a)] -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((k, a) -> (Key, a)) -> [(k, a)] -> [(Key, a)]
    forall a b. (a -> b) -> [a] -> [b]
    P.map ((k -> Key) -> (k, a) -> (Key, a)
    forall b c d. (b -> c) -> (b, d) -> (c, d)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (b, d) (c, d)
    first k -> Key
    forall a. Enum a => a -> Key
    fromEnum)
    {-# INLINE fromAscListWith #-}

    fromAscListWithKey :: (Enum k) => (k -> a -> a -> a) -> [(k, a)] -> EnumMap k a
    fromAscListWithKey :: forall k a. Enum k => (k -> a -> a -> a) -> [(k, a)] -> EnumMap k a
    fromAscListWithKey k -> a -> a -> a
    f =
      IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> ([(k, a)] -> IntMap a) -> [(k, a)] -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Key -> a -> a -> a) -> [(Key, a)] -> IntMap a
    forall a. (Key -> a -> a -> a) -> [(Key, a)] -> IntMap a
    I.fromAscListWithKey (k -> a -> a -> a
    f (k -> a -> a -> a) -> (Key -> k) -> Key -> a -> a -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Key -> k
    forall a. Enum a => Key -> a
    toEnum) ([(Key, a)] -> IntMap a)
    -> ([(k, a)] -> [(Key, a)]) -> [(k, a)] -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((k, a) -> (Key, a)) -> [(k, a)] -> [(Key, a)]
    forall a b. (a -> b) -> [a] -> [b]
    P.map ((k -> Key) -> (k, a) -> (Key, a)
    forall b c d. (b -> c) -> (b, d) -> (c, d)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (b, d) (c, d)
    first k -> Key
    forall a. Enum a => a -> Key
    fromEnum)
    {-# INLINE fromAscListWithKey #-}

    fromDistinctAscList :: (Enum k) => [(k, a)] -> EnumMap k a
    fromDistinctAscList :: forall k a. Enum k => [(k, a)] -> EnumMap k a
    fromDistinctAscList = IntMap a -> EnumMap k a
    forall k a. IntMap a -> EnumMap k a
    EnumMap (IntMap a -> EnumMap k a)
    -> ([(k, a)] -> IntMap a) -> [(k, a)] -> EnumMap k a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [(Key, a)] -> IntMap a
    forall a. [(Key, a)] -> IntMap a
    I.fromDistinctAscList ([(Key, a)] -> IntMap a)
    -> ([(k, a)] -> [(Key, a)]) -> [(k, a)] -> IntMap a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((k, a) -> (Key, a)) -> [(k, a)] -> [(Key, a)]
    forall a b. (a -> b) -> [a] -> [b]
    P.map ((k -> Key) -> (k, a) -> (Key, a)
    forall b c d. (b -> c) -> (b, d) -> (c, d)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (b, d) (c, d)
    first k -> Key
    forall a. Enum a => a -> Key
    fromEnum)
    {-# INLINE fromDistinctAscList #-}