{-# LANGUAGE CPP #-}

module Data.IntMap.EnumMap2 where

import Data.Foldable as F (Foldable(foldMap))
import qualified Data.IntMap as M
#if MIN_VERSION_containers(0,5,11)
import qualified Data.IntMap.Internal.Debug as MD
#else
import qualified Data.IntMap as MD
#endif
import qualified Data.IntSet.EnumSet2 as S (EnumSet(..))
import Data.Semigroup as Sem
import Prelude
import qualified Prelude as L (map)

newtype EnumMap k a = EnumMap {EnumMap k a -> IntMap a
unEnumMap :: M.IntMap a}
  deriving (EnumMap k a -> EnumMap k a -> Bool
(EnumMap k a -> EnumMap k a -> Bool)
-> (EnumMap k a -> EnumMap k a -> Bool) -> Eq (EnumMap k a)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k a. Eq a => EnumMap k a -> EnumMap k a -> Bool
/= :: EnumMap k a -> EnumMap k a -> Bool
$c/= :: forall k a. Eq a => EnumMap k a -> EnumMap k a -> Bool
== :: EnumMap k a -> EnumMap k a -> Bool
$c== :: forall k a. Eq a => EnumMap k a -> EnumMap k a -> Bool
Eq,Eq (EnumMap k a)
Eq (EnumMap k a)
-> (EnumMap k a -> EnumMap k a -> Ordering)
-> (EnumMap k a -> EnumMap k a -> Bool)
-> (EnumMap k a -> EnumMap k a -> Bool)
-> (EnumMap k a -> EnumMap k a -> Bool)
-> (EnumMap k a -> EnumMap k a -> Bool)
-> (EnumMap k a -> EnumMap k a -> EnumMap k a)
-> (EnumMap k a -> EnumMap k a -> EnumMap k a)
-> Ord (EnumMap k a)
EnumMap k a -> EnumMap k a -> Bool
EnumMap k a -> EnumMap k a -> Ordering
EnumMap k a -> EnumMap k a -> EnumMap 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 a => Eq (EnumMap k a)
forall k a. Ord a => EnumMap k a -> EnumMap k a -> Bool
forall k a. Ord a => EnumMap k a -> EnumMap k a -> Ordering
forall k a. Ord a => EnumMap k a -> EnumMap k a -> EnumMap k a
min :: EnumMap k a -> EnumMap k a -> EnumMap k a
$cmin :: forall k a. Ord a => EnumMap k a -> EnumMap k a -> EnumMap k a
max :: EnumMap k a -> EnumMap k a -> EnumMap k a
$cmax :: forall k a. Ord a => EnumMap k a -> EnumMap k a -> EnumMap k a
>= :: EnumMap k a -> EnumMap k a -> Bool
$c>= :: forall k a. Ord a => EnumMap k a -> EnumMap k a -> Bool
> :: EnumMap k a -> EnumMap k a -> Bool
$c> :: forall k a. Ord a => EnumMap k a -> EnumMap k a -> Bool
<= :: EnumMap k a -> EnumMap k a -> Bool
$c<= :: forall k a. Ord a => EnumMap k a -> EnumMap k a -> Bool
< :: EnumMap k a -> EnumMap k a -> Bool
$c< :: forall k a. Ord a => EnumMap k a -> EnumMap k a -> Bool
compare :: EnumMap k a -> EnumMap k a -> Ordering
$ccompare :: forall k a. Ord a => EnumMap k a -> EnumMap k a -> Ordering
$cp1Ord :: forall k a. Ord a => Eq (EnumMap k a)
Ord,ReadPrec [EnumMap k a]
ReadPrec (EnumMap k a)
Int -> ReadS (EnumMap k a)
ReadS [EnumMap k a]
(Int -> ReadS (EnumMap k a))
-> ReadS [EnumMap k a]
-> ReadPrec (EnumMap k a)
-> ReadPrec [EnumMap k a]
-> Read (EnumMap k a)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k a. Read a => ReadPrec [EnumMap k a]
forall k a. Read a => ReadPrec (EnumMap k a)
forall k a. Read a => Int -> ReadS (EnumMap k a)
forall k a. Read a => ReadS [EnumMap k a]
readListPrec :: ReadPrec [EnumMap k a]
$creadListPrec :: forall k a. Read a => ReadPrec [EnumMap k a]
readPrec :: ReadPrec (EnumMap k a)
$creadPrec :: forall k a. Read a => ReadPrec (EnumMap k a)
readList :: ReadS [EnumMap k a]
$creadList :: forall k a. Read a => ReadS [EnumMap k a]
readsPrec :: Int -> ReadS (EnumMap k a)
$creadsPrec :: forall k a. Read a => Int -> ReadS (EnumMap k a)
Read,Int -> EnumMap k a -> ShowS
[EnumMap k a] -> ShowS
EnumMap k a -> String
(Int -> EnumMap k a -> ShowS)
-> (EnumMap k a -> String)
-> ([EnumMap k a] -> ShowS)
-> Show (EnumMap k a)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k a. Show a => Int -> EnumMap k a -> ShowS
forall k a. Show a => [EnumMap k a] -> ShowS
forall k a. Show a => EnumMap k a -> String
showList :: [EnumMap k a] -> ShowS
$cshowList :: forall k a. Show a => [EnumMap k a] -> ShowS
show :: EnumMap k a -> String
$cshow :: forall k a. Show a => EnumMap k a -> String
showsPrec :: Int -> EnumMap k a -> ShowS
$cshowsPrec :: forall k a. Show a => Int -> EnumMap k a -> ShowS
Show)

instance Ord k => Sem.Semigroup (EnumMap k a) where
  EnumMap IntMap a
x <> :: EnumMap k a -> EnumMap k a -> EnumMap k a
<> EnumMap IntMap a
y = IntMap a -> EnumMap k a
forall k a. IntMap a -> EnumMap k a
EnumMap (IntMap a
x IntMap a -> IntMap a -> IntMap a
forall a. Monoid a => a -> a -> a
`mappend` IntMap a
y)

instance Ord k => Monoid (EnumMap k a) where
  mempty :: EnumMap k a
mempty = IntMap a -> EnumMap k a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
forall a. Monoid a => a
mempty
  mappend :: EnumMap k a -> EnumMap k a -> EnumMap k a
mappend = EnumMap k a -> EnumMap k a -> EnumMap k a
forall a. Semigroup a => a -> a -> a
(<>)

instance Ord k => Functor (EnumMap k) where
  fmap :: (a -> b) -> EnumMap k a -> EnumMap k b
fmap a -> b
f (EnumMap IntMap a
m) = IntMap b -> EnumMap k b
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> b) -> IntMap a -> IntMap b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f IntMap a
m)

instance Ord k => F.Foldable (EnumMap k) where
  foldMap :: (a -> m) -> EnumMap k a -> m
foldMap a -> m
f (EnumMap IntMap a
m) = (a -> m) -> IntMap a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
F.foldMap a -> m
f IntMap a
m

(!) :: (Enum key) => EnumMap key a -> key -> a
(!) (EnumMap IntMap a
m) key
k = IntMap a -> Int -> a
forall a. IntMap a -> Int -> a
(M.!) IntMap a
m (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k)

(\\) :: (Enum key) => EnumMap key a -> EnumMap key b -> EnumMap key a
\\ :: EnumMap key a -> EnumMap key b -> EnumMap key a
(\\) (EnumMap IntMap a
m1) (EnumMap IntMap b
m2) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap (IntMap a -> IntMap b -> IntMap a
forall a b. IntMap a -> IntMap b -> IntMap a
(M.\\) IntMap a
m1 IntMap b
m2)

null :: (Enum key) => EnumMap key a -> Bool
null :: EnumMap key a -> Bool
null (EnumMap IntMap a
m) = IntMap a -> Bool
forall a. IntMap a -> Bool
M.null IntMap a
m

size :: (Enum key) => EnumMap key a -> Int
size :: EnumMap key a -> Int
size (EnumMap IntMap a
m) = IntMap a -> Int
forall a. IntMap a -> Int
M.size IntMap a
m

member :: (Enum key) => key -> EnumMap key a -> Bool
member :: key -> EnumMap key a -> Bool
member key
k (EnumMap IntMap a
m) = Int -> IntMap a -> Bool
forall a. Int -> IntMap a -> Bool
M.member (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m

notMember :: (Enum key) => key -> EnumMap key a -> Bool
notMember :: key -> EnumMap key a -> Bool
notMember key
k (EnumMap IntMap a
m) = Int -> IntMap a -> Bool
forall a. Int -> IntMap a -> Bool
M.notMember (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m

{-# INLINE lookup #-}
lookup :: (Enum key) => key -> EnumMap key a -> Maybe a
lookup :: key -> EnumMap key a -> Maybe a
lookup key
k (EnumMap IntMap a
m) = Int -> IntMap a -> Maybe a
forall a. Int -> IntMap a -> Maybe a
M.lookup (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m

findWithDefault :: (Enum key) => a -> key -> EnumMap key a -> a
findWithDefault :: a -> key -> EnumMap key a -> a
findWithDefault a
a key
k (EnumMap IntMap a
m) = a -> Int -> IntMap a -> a
forall a. a -> Int -> IntMap a -> a
M.findWithDefault a
a (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m

empty :: (Enum key) => EnumMap key a
empty :: EnumMap key a
empty = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
forall a. IntMap a
M.empty

singleton :: (Enum key) => key -> a -> EnumMap key a
singleton :: key -> a -> EnumMap key a
singleton key
k a
a = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap (Int -> a -> IntMap a
forall a. Int -> a -> IntMap a
M.singleton (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) a
a)

insert :: (Enum key) => key -> a -> EnumMap key a -> EnumMap key a
insert :: key -> a -> EnumMap key a -> EnumMap key a
insert key
k a
a (EnumMap IntMap a
m) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap (Int -> a -> IntMap a -> IntMap a
forall a. Int -> a -> IntMap a -> IntMap a
M.insert (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) a
a IntMap a
m)

insertWith :: (Enum key) => (a -> a -> a) -> key -> a -> EnumMap key a -> EnumMap key a
insertWith :: (a -> a -> a) -> key -> a -> EnumMap key a -> EnumMap key a
insertWith a -> a -> a
f key
k a
a (EnumMap IntMap a
m) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> a -> a) -> Int -> a -> IntMap a -> IntMap a
forall a. (a -> a -> a) -> Int -> a -> IntMap a -> IntMap a
M.insertWith a -> a -> a
f (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) a
a IntMap a
m)

insertWithKey :: (Enum key) => (key -> a -> a -> a) -> key -> a -> EnumMap key a -> EnumMap key a
insertWithKey :: (key -> a -> a -> a) -> key -> a -> EnumMap key a -> EnumMap key a
insertWithKey key -> a -> a -> a
f key
k a
a (EnumMap IntMap a
m) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> a -> a) -> Int -> a -> IntMap a -> IntMap a
forall a. (Int -> a -> a -> a) -> Int -> a -> IntMap a -> IntMap a
M.insertWithKey Int -> a -> a -> a
f' (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) a
a IntMap a
m)
  where f' :: Int -> a -> a -> a
f' Int
b a
a1 a
a2 = key -> a -> a -> a
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a1 a
a2

insertLookupWithKey :: (Enum key) => (key -> a -> a -> a) -> key -> a -> EnumMap key a -> (Maybe a, EnumMap key a)
insertLookupWithKey :: (key -> a -> a -> a)
-> key -> a -> EnumMap key a -> (Maybe a, EnumMap key a)
insertLookupWithKey key -> a -> a -> a
f key
k a
a (EnumMap IntMap a
m) = (Maybe a
ma,IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
m')
  where (Maybe a
ma,IntMap a
m') = (Int -> a -> a -> a) -> Int -> a -> IntMap a -> (Maybe a, IntMap a)
forall a.
(Int -> a -> a -> a) -> Int -> a -> IntMap a -> (Maybe a, IntMap a)
M.insertLookupWithKey Int -> a -> a -> a
f' (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) a
a IntMap a
m
        f' :: Int -> a -> a -> a
f' Int
b a
a1 a
a2 = key -> a -> a -> a
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a1 a
a2

delete :: (Enum key) => key -> EnumMap key a -> EnumMap key a
delete :: key -> EnumMap key a -> EnumMap key a
delete key
k (EnumMap IntMap a
m) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap (Int -> IntMap a -> IntMap a
forall a. Int -> IntMap a -> IntMap a
M.delete (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m)

adjust :: (Enum key) => (a -> a) -> key -> EnumMap key a -> EnumMap key a
adjust :: (a -> a) -> key -> EnumMap key a -> EnumMap key a
adjust a -> a
f key
k (EnumMap IntMap a
m) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> a) -> Int -> IntMap a -> IntMap a
forall a. (a -> a) -> Int -> IntMap a -> IntMap a
M.adjust a -> a
f (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m)

adjustWithKey :: (Enum key) => (key -> a -> a) -> key -> EnumMap key a -> EnumMap key a
adjustWithKey :: (key -> a -> a) -> key -> EnumMap key a -> EnumMap key a
adjustWithKey key -> a -> a
f key
k (EnumMap IntMap a
m) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> a) -> Int -> IntMap a -> IntMap a
forall a. (Int -> a -> a) -> Int -> IntMap a -> IntMap a
M.adjustWithKey Int -> a -> a
f' (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m)
  where f' :: Int -> a -> a
f' Int
b a
a = key -> a -> a
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a

update :: (Enum key) => (a -> Maybe a) -> key -> EnumMap key a -> EnumMap key a
update :: (a -> Maybe a) -> key -> EnumMap key a -> EnumMap key a
update a -> Maybe a
f key
k (EnumMap IntMap a
m) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> Maybe a) -> Int -> IntMap a -> IntMap a
forall a. (a -> Maybe a) -> Int -> IntMap a -> IntMap a
M.update a -> Maybe a
f (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m)

updateWithKey :: (Enum key) => (key -> a -> Maybe a) -> key -> EnumMap key a -> EnumMap key a
updateWithKey :: (key -> a -> Maybe a) -> key -> EnumMap key a -> EnumMap key a
updateWithKey key -> a -> Maybe a
f key
k (EnumMap IntMap a
m) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> Maybe a) -> Int -> IntMap a -> IntMap a
forall a. (Int -> a -> Maybe a) -> Int -> IntMap a -> IntMap a
M.updateWithKey Int -> a -> Maybe a
f' (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m)
  where f' :: Int -> a -> Maybe a
f' Int
b a
a = key -> a -> Maybe a
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a

updateLookupWithKey :: (Enum key) => (key -> a -> Maybe a) -> key -> EnumMap key a -> (Maybe a, EnumMap key a)
updateLookupWithKey :: (key -> a -> Maybe a)
-> key -> EnumMap key a -> (Maybe a, EnumMap key a)
updateLookupWithKey key -> a -> Maybe a
f key
k (EnumMap IntMap a
m) = (Maybe a
a,IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
m')
  where (Maybe a
a,IntMap a
m') = (Int -> a -> Maybe a) -> Int -> IntMap a -> (Maybe a, IntMap a)
forall a.
(Int -> a -> Maybe a) -> Int -> IntMap a -> (Maybe a, IntMap a)
M.updateLookupWithKey Int -> a -> Maybe a
f' (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m
        f' :: Int -> a -> Maybe a
f' Int
b a
a1 = key -> a -> Maybe a
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a1

union :: (Enum key) => EnumMap key a -> EnumMap key a -> EnumMap key a
union :: EnumMap key a -> EnumMap key a -> EnumMap key a
union (EnumMap IntMap a
m1) (EnumMap IntMap a
m2) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap (IntMap a -> IntMap a -> IntMap a
forall a. IntMap a -> IntMap a -> IntMap a
M.union IntMap a
m1 IntMap a
m2)

unionWith :: (Enum key) => (a -> a -> a) -> EnumMap key a -> EnumMap key a -> EnumMap key a
unionWith :: (a -> a -> a) -> EnumMap key a -> EnumMap key a -> EnumMap key a
unionWith a -> a -> a
f (EnumMap IntMap a
m1) (EnumMap IntMap a
m2) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
forall a. (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
M.unionWith a -> a -> a
f IntMap a
m1 IntMap a
m2)

unionWithKey :: (Enum key) => (key -> a -> a -> a) -> EnumMap key a -> EnumMap key a -> EnumMap key a
unionWithKey :: (key -> a -> a -> a)
-> EnumMap key a -> EnumMap key a -> EnumMap key a
unionWithKey key -> a -> a -> a
f (EnumMap IntMap a
m1) (EnumMap IntMap a
m2) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
forall a. (Int -> a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
M.unionWithKey Int -> a -> a -> a
f' IntMap a
m1 IntMap a
m2)
  where f' :: Int -> a -> a -> a
f' Int
b a
a1 a
a2 = key -> a -> a -> a
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a1 a
a2

unions :: (Enum key) => [EnumMap key a] -> EnumMap key a
unions :: [EnumMap key a] -> EnumMap key a
unions [EnumMap key a]
cs = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ([IntMap a] -> IntMap a
forall (f :: * -> *) a. Foldable f => f (IntMap a) -> IntMap a
M.unions ((EnumMap key a -> IntMap a) -> [EnumMap key a] -> [IntMap a]
forall a b. (a -> b) -> [a] -> [b]
L.map EnumMap key a -> IntMap a
forall k a. EnumMap k a -> IntMap a
unEnumMap [EnumMap key a]
cs))

unionsWith :: (Enum key) => (a -> a -> a) -> [EnumMap key a] -> EnumMap key a
unionsWith :: (a -> a -> a) -> [EnumMap key a] -> EnumMap key a
unionsWith a -> a -> a
f [EnumMap key a]
cs = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> a -> a) -> [IntMap a] -> IntMap a
forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> f (IntMap a) -> IntMap a
M.unionsWith a -> a -> a
f ((EnumMap key a -> IntMap a) -> [EnumMap key a] -> [IntMap a]
forall a b. (a -> b) -> [a] -> [b]
L.map EnumMap key a -> IntMap a
forall k a. EnumMap k a -> IntMap a
unEnumMap [EnumMap key a]
cs))

difference :: (Enum key) => EnumMap key a -> EnumMap key b -> EnumMap key a
difference :: EnumMap key a -> EnumMap key b -> EnumMap key a
difference (EnumMap IntMap a
m1) (EnumMap IntMap b
m2) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap (IntMap a -> IntMap b -> IntMap a
forall a b. IntMap a -> IntMap b -> IntMap a
M.difference IntMap a
m1 IntMap b
m2)

differenceWith :: (Enum key) => (a -> b -> Maybe a) -> EnumMap key a -> EnumMap key b -> EnumMap key a
differenceWith :: (a -> b -> Maybe a)
-> EnumMap key a -> EnumMap key b -> EnumMap key a
differenceWith a -> b -> Maybe a
f (EnumMap IntMap a
m1) (EnumMap IntMap b
m2) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
forall a b. (a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
M.differenceWith a -> b -> Maybe a
f IntMap a
m1 IntMap b
m2)

differenceWithKey :: (Enum key) => (key -> a -> b -> Maybe a) -> EnumMap key a -> EnumMap key b -> EnumMap key a
differenceWithKey :: (key -> a -> b -> Maybe a)
-> EnumMap key a -> EnumMap key b -> EnumMap key a
differenceWithKey key -> a -> b -> Maybe a
f (EnumMap IntMap a
m1) (EnumMap IntMap b
m2) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
forall a b.
(Int -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
M.differenceWithKey Int -> a -> b -> Maybe a
f' IntMap a
m1 IntMap b
m2)
  where f' :: Int -> a -> b -> Maybe a
f' Int
b a
a1 b
a2 = key -> a -> b -> Maybe a
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a1 b
a2

intersection :: (Enum key) => EnumMap key a -> EnumMap key b -> EnumMap key a
intersection :: EnumMap key a -> EnumMap key b -> EnumMap key a
intersection (EnumMap IntMap a
m1) (EnumMap IntMap b
m2) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap (IntMap a -> IntMap b -> IntMap a
forall a b. IntMap a -> IntMap b -> IntMap a
M.intersection IntMap a
m1 IntMap b
m2)

intersectionWith :: (Enum key) => (a -> b -> a) -> EnumMap key a -> EnumMap key b -> EnumMap key a
intersectionWith :: (a -> b -> a) -> EnumMap key a -> EnumMap key b -> EnumMap key a
intersectionWith a -> b -> a
f (EnumMap IntMap a
m1) (EnumMap IntMap b
m2) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> b -> a) -> IntMap a -> IntMap b -> IntMap a
forall a b c. (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
M.intersectionWith a -> b -> a
f IntMap a
m1 IntMap b
m2)

intersectionWithKey :: (Enum key) => (key -> a -> b -> a) -> EnumMap key a -> EnumMap key b -> EnumMap key a
intersectionWithKey :: (key -> a -> b -> a)
-> EnumMap key a -> EnumMap key b -> EnumMap key a
intersectionWithKey key -> a -> b -> a
f (EnumMap IntMap a
m1) (EnumMap IntMap b
m2) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> b -> a) -> IntMap a -> IntMap b -> IntMap a
forall a b c.
(Int -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
M.intersectionWithKey Int -> a -> b -> a
f' IntMap a
m1 IntMap b
m2)
  where f' :: Int -> a -> b -> a
f' Int
b a
a1 b
a2 = key -> a -> b -> a
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a1 b
a2

map :: (Enum key) => (a -> b) -> EnumMap key a -> EnumMap key b
map :: (a -> b) -> EnumMap key a -> EnumMap key b
map a -> b
f (EnumMap IntMap a
m) = IntMap b -> EnumMap key b
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> b) -> IntMap a -> IntMap b
forall a b. (a -> b) -> IntMap a -> IntMap b
M.map a -> b
f IntMap a
m)

mapWithKey :: (Enum key) => (key -> a -> b) -> EnumMap key a -> EnumMap key b
mapWithKey :: (key -> a -> b) -> EnumMap key a -> EnumMap key b
mapWithKey key -> a -> b
f (EnumMap IntMap a
m) = IntMap b -> EnumMap key b
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> b) -> IntMap a -> IntMap b
forall a b. (Int -> a -> b) -> IntMap a -> IntMap b
M.mapWithKey Int -> a -> b
f' IntMap a
m)
  where f' :: Int -> a -> b
f' Int
b a
a = key -> a -> b
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a

mapAccum :: (Enum key) => (a -> b -> (a, c)) -> a -> EnumMap key b -> (a, EnumMap key c)
mapAccum :: (a -> b -> (a, c)) -> a -> EnumMap key b -> (a, EnumMap key c)
mapAccum a -> b -> (a, c)
f a
a (EnumMap IntMap b
m) = (a
a',IntMap c -> EnumMap key c
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap c
m')
  where (a
a',IntMap c
m') = (a -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
forall a b c. (a -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
M.mapAccum a -> b -> (a, c)
f a
a IntMap b
m

mapAccumWithKey :: (Enum key) => (a -> key -> b -> (a, c)) -> a -> EnumMap key b -> (a, EnumMap key c)
mapAccumWithKey :: (a -> key -> b -> (a, c))
-> a -> EnumMap key b -> (a, EnumMap key c)
mapAccumWithKey a -> key -> b -> (a, c)
f a
a (EnumMap IntMap b
m) = (a
a',IntMap c -> EnumMap key c
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap c
m')
  where (a
a',IntMap c
m') = (a -> Int -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
forall a b c.
(a -> Int -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
M.mapAccumWithKey a -> Int -> b -> (a, c)
f' a
a IntMap b
m
        f' :: a -> Int -> b -> (a, c)
f' a
a1 Int
b b
a2 = a -> key -> b -> (a, c)
f a
a1 (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) b
a2

fold :: (Enum key) => (a -> b -> b) -> b -> EnumMap key a -> b
fold :: (a -> b -> b) -> b -> EnumMap key a -> b
fold a -> b -> b
f b
a (EnumMap IntMap a
m) = (a -> b -> b) -> b -> IntMap a -> b
forall a b. (a -> b -> b) -> b -> IntMap a -> b
M.foldr a -> b -> b
f b
a IntMap a
m

foldWithKey :: (Enum key) => (key -> a -> b -> b) -> b -> EnumMap key a -> b
foldWithKey :: (key -> a -> b -> b) -> b -> EnumMap key a -> b
foldWithKey key -> a -> b -> b
f b
a (EnumMap IntMap a
m) = (Int -> a -> b -> b) -> b -> IntMap a -> b
forall a b. (Int -> a -> b -> b) -> b -> IntMap a -> b
M.foldrWithKey Int -> a -> b -> b
f' b
a IntMap a
m
  where f' :: Int -> a -> b -> b
f' Int
b a
a1 b
a2 = key -> a -> b -> b
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a1 b
a2

elems :: (Enum key) => EnumMap key a -> [a]
elems :: EnumMap key a -> [a]
elems (EnumMap IntMap a
m) = IntMap a -> [a]
forall a. IntMap a -> [a]
M.elems IntMap a
m

keys :: (Enum key) => EnumMap key a -> [key]
keys :: EnumMap key a -> [key]
keys (EnumMap IntMap a
m) = (Int -> key) -> [Int] -> [key]
forall a b. (a -> b) -> [a] -> [b]
L.map Int -> key
forall a. Enum a => Int -> a
toEnum (IntMap a -> [Int]
forall a. IntMap a -> [Int]
M.keys IntMap a
m)

-- Have to break cover until I have CharSet
keysSet :: (Enum key) => EnumMap key a -> S.EnumSet key
keysSet :: EnumMap key a -> EnumSet key
keysSet (EnumMap IntMap a
m) = IntSet -> EnumSet key
forall e. IntSet -> EnumSet e
S.EnumSet (IntMap a -> IntSet
forall a. IntMap a -> IntSet
M.keysSet IntMap a
m)

assocs :: (Enum key) => EnumMap key a -> [(key, a)]
assocs :: EnumMap key a -> [(key, a)]
assocs (EnumMap IntMap a
m) = ((Int, a) -> (key, a)) -> [(Int, a)] -> [(key, a)]
forall a b. (a -> b) -> [a] -> [b]
L.map (\(Int
b,a
a) -> (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b,a
a)) (IntMap a -> [(Int, a)]
forall a. IntMap a -> [(Int, a)]
M.assocs IntMap a
m)

toList :: (Enum key) => EnumMap key a -> [(key, a)]
toList :: EnumMap key a -> [(key, a)]
toList (EnumMap IntMap a
m) = ((Int, a) -> (key, a)) -> [(Int, a)] -> [(key, a)]
forall a b. (a -> b) -> [a] -> [b]
L.map (\(Int
b,a
a) -> (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b,a
a)) (IntMap a -> [(Int, a)]
forall a. IntMap a -> [(Int, a)]
M.toList IntMap a
m)

fromList :: (Enum key) => [(key, a)] -> EnumMap key a
fromList :: [(key, a)] -> EnumMap key a
fromList [(key, a)]
ka = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ([(Int, a)] -> IntMap a
forall a. [(Int, a)] -> IntMap a
M.fromList (((key, a) -> (Int, a)) -> [(key, a)] -> [(Int, a)]
forall a b. (a -> b) -> [a] -> [b]
L.map (\(key
k,a
a) -> (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k,a
a)) [(key, a)]
ka))

fromListWith :: (Enum key) => (a -> a -> a) -> [(key, a)] -> EnumMap key a
fromListWith :: (a -> a -> a) -> [(key, a)] -> EnumMap key a
fromListWith a -> a -> a
f [(key, a)]
ka = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> a -> a) -> [(Int, a)] -> IntMap a
forall a. (a -> a -> a) -> [(Int, a)] -> IntMap a
M.fromListWith a -> a -> a
f (((key, a) -> (Int, a)) -> [(key, a)] -> [(Int, a)]
forall a b. (a -> b) -> [a] -> [b]
L.map (\(key
k,a
a) -> (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k,a
a)) [(key, a)]
ka))

fromListWithKey :: (Enum key) => (key -> a -> a -> a) -> [(key, a)] -> EnumMap key a
fromListWithKey :: (key -> a -> a -> a) -> [(key, a)] -> EnumMap key a
fromListWithKey key -> a -> a -> a
f [(key, a)]
ka = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> a -> a) -> [(Int, a)] -> IntMap a
forall a. (Int -> a -> a -> a) -> [(Int, a)] -> IntMap a
M.fromListWithKey Int -> a -> a -> a
f' (((key, a) -> (Int, a)) -> [(key, a)] -> [(Int, a)]
forall a b. (a -> b) -> [a] -> [b]
L.map (\(key
k,a
a) -> (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k,a
a)) [(key, a)]
ka))
  where f' :: Int -> a -> a -> a
f' Int
b a
a1 a
a2 = key -> a -> a -> a
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a1 a
a2

toAscList :: (Enum key) => EnumMap key a -> [(key, a)]
toAscList :: EnumMap key a -> [(key, a)]
toAscList (EnumMap IntMap a
m) = ((Int, a) -> (key, a)) -> [(Int, a)] -> [(key, a)]
forall a b. (a -> b) -> [a] -> [b]
L.map (\(Int
b,a
a) -> (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b,a
a)) (IntMap a -> [(Int, a)]
forall a. IntMap a -> [(Int, a)]
M.toAscList IntMap a
m)

fromAscList :: (Enum key) => [(key, a)] -> EnumMap key a
fromAscList :: [(key, a)] -> EnumMap key a
fromAscList [(key, a)]
ka = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ([(Int, a)] -> IntMap a
forall a. [(Int, a)] -> IntMap a
M.fromAscList (((key, a) -> (Int, a)) -> [(key, a)] -> [(Int, a)]
forall a b. (a -> b) -> [a] -> [b]
L.map (\(key
k,a
a) -> (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k,a
a)) [(key, a)]
ka))

fromAscListWith :: (Enum key) => (a -> a -> a) -> [(key, a)] -> EnumMap key a
fromAscListWith :: (a -> a -> a) -> [(key, a)] -> EnumMap key a
fromAscListWith a -> a -> a
f [(key, a)]
ka = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> a -> a) -> [(Int, a)] -> IntMap a
forall a. (a -> a -> a) -> [(Int, a)] -> IntMap a
M.fromAscListWith a -> a -> a
f (((key, a) -> (Int, a)) -> [(key, a)] -> [(Int, a)]
forall a b. (a -> b) -> [a] -> [b]
L.map (\(key
k,a
a) -> (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k,a
a)) [(key, a)]
ka))

fromAscListWithKey :: (Enum key) => (key -> a -> a -> a) -> [(key, a)] -> EnumMap key a
fromAscListWithKey :: (key -> a -> a -> a) -> [(key, a)] -> EnumMap key a
fromAscListWithKey key -> a -> a -> a
f [(key, a)]
ka = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> a -> a) -> [(Int, a)] -> IntMap a
forall a. (Int -> a -> a -> a) -> [(Int, a)] -> IntMap a
M.fromAscListWithKey Int -> a -> a -> a
f' (((key, a) -> (Int, a)) -> [(key, a)] -> [(Int, a)]
forall a b. (a -> b) -> [a] -> [b]
L.map (\(key
k,a
a) -> (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k,a
a)) [(key, a)]
ka))
  where f' :: Int -> a -> a -> a
f' Int
b a
a1 a
a2 = key -> a -> a -> a
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a1 a
a2

fromDistinctAscList :: (Enum key) => [(key, a)] -> EnumMap key a
fromDistinctAscList :: [(key, a)] -> EnumMap key a
fromDistinctAscList [(key, a)]
ka = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ([(Int, a)] -> IntMap a
forall a. [(Int, a)] -> IntMap a
M.fromDistinctAscList (((key, a) -> (Int, a)) -> [(key, a)] -> [(Int, a)]
forall a b. (a -> b) -> [a] -> [b]
L.map (\(key
k,a
a) -> (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k,a
a)) [(key, a)]
ka))

filter :: (Enum key) => (a -> Bool) -> EnumMap key a -> EnumMap key a
filter :: (a -> Bool) -> EnumMap key a -> EnumMap key a
filter a -> Bool
f (EnumMap IntMap a
m) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> Bool) -> IntMap a -> IntMap a
forall a. (a -> Bool) -> IntMap a -> IntMap a
M.filter a -> Bool
f IntMap a
m)

filterWithKey :: (Enum key) => (key -> a -> Bool) -> EnumMap key a -> EnumMap key a
filterWithKey :: (key -> a -> Bool) -> EnumMap key a -> EnumMap key a
filterWithKey key -> a -> Bool
f (EnumMap IntMap a
m) = IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> Bool) -> IntMap a -> IntMap a
forall a. (Int -> a -> Bool) -> IntMap a -> IntMap a
M.filterWithKey Int -> a -> Bool
f' IntMap a
m)
  where f' :: Int -> a -> Bool
f' Int
b a
a = key -> a -> Bool
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a

partition :: (Enum key) => (a -> Bool) -> EnumMap key a -> (EnumMap key a, EnumMap key a)
partition :: (a -> Bool) -> EnumMap key a -> (EnumMap key a, EnumMap key a)
partition a -> Bool
f (EnumMap IntMap a
m) = (IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
m1', IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
m2')
  where (IntMap a
m1',IntMap a
m2') = (a -> Bool) -> IntMap a -> (IntMap a, IntMap a)
forall a. (a -> Bool) -> IntMap a -> (IntMap a, IntMap a)
M.partition a -> Bool
f IntMap a
m

partitionWithKey :: (Enum key) => (key -> a -> Bool) -> EnumMap key a -> (EnumMap key a, EnumMap key a)
partitionWithKey :: (key -> a -> Bool)
-> EnumMap key a -> (EnumMap key a, EnumMap key a)
partitionWithKey key -> a -> Bool
f (EnumMap IntMap a
m) = (IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
m1', IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
m2')
  where (IntMap a
m1',IntMap a
m2') = (Int -> a -> Bool) -> IntMap a -> (IntMap a, IntMap a)
forall a. (Int -> a -> Bool) -> IntMap a -> (IntMap a, IntMap a)
M.partitionWithKey Int -> a -> Bool
f' IntMap a
m
        f' :: Int -> a -> Bool
f' Int
b a
a = key -> a -> Bool
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a

mapMaybe :: (Enum key) => (a -> Maybe b) -> EnumMap key a -> EnumMap key b
mapMaybe :: (a -> Maybe b) -> EnumMap key a -> EnumMap key b
mapMaybe a -> Maybe b
f (EnumMap IntMap a
m) = IntMap b -> EnumMap key b
forall k a. IntMap a -> EnumMap k a
EnumMap ((a -> Maybe b) -> IntMap a -> IntMap b
forall a b. (a -> Maybe b) -> IntMap a -> IntMap b
M.mapMaybe a -> Maybe b
f IntMap a
m)

mapMaybeWithKey :: (Enum key) => (key -> a -> Maybe b) -> EnumMap key a -> EnumMap key b
mapMaybeWithKey :: (key -> a -> Maybe b) -> EnumMap key a -> EnumMap key b
mapMaybeWithKey key -> a -> Maybe b
f (EnumMap IntMap a
m) = IntMap b -> EnumMap key b
forall k a. IntMap a -> EnumMap k a
EnumMap ((Int -> a -> Maybe b) -> IntMap a -> IntMap b
forall a b. (Int -> a -> Maybe b) -> IntMap a -> IntMap b
M.mapMaybeWithKey Int -> a -> Maybe b
f' IntMap a
m)
  where f' :: Int -> a -> Maybe b
f' Int
b a
a = key -> a -> Maybe b
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a

mapEither :: (Enum key) => (a -> Either b c) -> EnumMap key a -> (EnumMap key b, EnumMap key c)
mapEither :: (a -> Either b c)
-> EnumMap key a -> (EnumMap key b, EnumMap key c)
mapEither a -> Either b c
f (EnumMap IntMap a
m) = (IntMap b -> EnumMap key b
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap b
m1', IntMap c -> EnumMap key c
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap c
m2')
  where (IntMap b
m1',IntMap c
m2') = (a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
forall a b c. (a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
M.mapEither a -> Either b c
f IntMap a
m

mapEitherWithKey :: (Enum key) => (key -> a -> Either b c) -> EnumMap key a -> (EnumMap key b, EnumMap key c)
mapEitherWithKey :: (key -> a -> Either b c)
-> EnumMap key a -> (EnumMap key b, EnumMap key c)
mapEitherWithKey key -> a -> Either b c
f (EnumMap IntMap a
m) = (IntMap b -> EnumMap key b
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap b
m1', IntMap c -> EnumMap key c
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap c
m2')
  where (IntMap b
m1',IntMap c
m2') = (Int -> a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
forall a b c.
(Int -> a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
M.mapEitherWithKey Int -> a -> Either b c
f' IntMap a
m
        f' :: Int -> a -> Either b c
f' Int
b a
a = key -> a -> Either b c
f (Int -> key
forall a. Enum a => Int -> a
toEnum Int
b) a
a

split :: (Enum key) => key -> EnumMap key a -> (EnumMap key a, EnumMap key a)
split :: key -> EnumMap key a -> (EnumMap key a, EnumMap key a)
split key
k (EnumMap IntMap a
m) = (IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
m1', IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
m2')
  where (IntMap a
m1',IntMap a
m2') = Int -> IntMap a -> (IntMap a, IntMap a)
forall a. Int -> IntMap a -> (IntMap a, IntMap a)
M.split (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m

splitLookup :: (Enum key) => key -> EnumMap key a -> (EnumMap key a, Maybe a, EnumMap key a)
splitLookup :: key -> EnumMap key a -> (EnumMap key a, Maybe a, EnumMap key a)
splitLookup key
k (EnumMap IntMap a
m) = (IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
m1', Maybe a
a, IntMap a -> EnumMap key a
forall k a. IntMap a -> EnumMap k a
EnumMap IntMap a
m2')
  where (IntMap a
m1',Maybe a
a,IntMap a
m2') = Int -> IntMap a -> (IntMap a, Maybe a, IntMap a)
forall a. Int -> IntMap a -> (IntMap a, Maybe a, IntMap a)
M.splitLookup (key -> Int
forall a. Enum a => a -> Int
fromEnum key
k) IntMap a
m

isSubmapOf :: (Enum key,Eq a) => EnumMap key a -> EnumMap key a -> Bool
isSubmapOf :: EnumMap key a -> EnumMap key a -> Bool
isSubmapOf (EnumMap IntMap a
m1) (EnumMap IntMap a
m2) = IntMap a -> IntMap a -> Bool
forall a. Eq a => IntMap a -> IntMap a -> Bool
M.isSubmapOf IntMap a
m1 IntMap a
m2

isSubmapOfBy :: (Enum key) => (a -> b -> Bool) -> EnumMap key a -> EnumMap key b -> Bool
isSubmapOfBy :: (a -> b -> Bool) -> EnumMap key a -> EnumMap key b -> Bool
isSubmapOfBy a -> b -> Bool
f (EnumMap IntMap a
m1) (EnumMap IntMap b
m2) = (a -> b -> Bool) -> IntMap a -> IntMap b -> Bool
forall a b. (a -> b -> Bool) -> IntMap a -> IntMap b -> Bool
M.isSubmapOfBy a -> b -> Bool
f IntMap a
m1 IntMap b
m2

isProperSubmapOf :: (Enum key,Eq a) => EnumMap key a -> EnumMap key a -> Bool
isProperSubmapOf :: EnumMap key a -> EnumMap key a -> Bool
isProperSubmapOf (EnumMap IntMap a
m1) (EnumMap IntMap a
m2) = IntMap a -> IntMap a -> Bool
forall a. Eq a => IntMap a -> IntMap a -> Bool
M.isProperSubmapOf IntMap a
m1 IntMap a
m2

isProperSubmapOfBy :: (Enum key) => (a -> b -> Bool) -> EnumMap key a -> EnumMap key b -> Bool
isProperSubmapOfBy :: (a -> b -> Bool) -> EnumMap key a -> EnumMap key b -> Bool
isProperSubmapOfBy a -> b -> Bool
f (EnumMap IntMap a
m1) (EnumMap IntMap b
m2) = (a -> b -> Bool) -> IntMap a -> IntMap b -> Bool
forall a b. (a -> b -> Bool) -> IntMap a -> IntMap b -> Bool
M.isProperSubmapOfBy a -> b -> Bool
f IntMap a
m1 IntMap b
m2

showTree :: (Enum key,Show a) => EnumMap key a -> String
showTree :: EnumMap key a -> String
showTree (EnumMap IntMap a
m) = IntMap a -> String
forall a. Show a => IntMap a -> String
MD.showTree IntMap a
m

showTreeWith :: (Enum key,Show a) => Bool -> Bool -> EnumMap key a -> String
showTreeWith :: Bool -> Bool -> EnumMap key a -> String
showTreeWith Bool
b1 Bool
b2 (EnumMap IntMap a
m) = Bool -> Bool -> IntMap a -> String
forall a. Show a => Bool -> Bool -> IntMap a -> String
MD.showTreeWith Bool
b1 Bool
b2 IntMap a
m