module Calamity.Internal.SnowflakeMap where
import Calamity.Internal.Utils ()
import Calamity.Types.Snowflake
import Data.Aeson (FromJSON (..), ToJSON (..), withArray)
import Data.Data
import Data.Foldable qualified as F
import Data.HashMap.Strict (HashMap)
import Data.HashMap.Strict qualified as SH
import Data.Hashable
import GHC.Exts (IsList)
import Optics
import TextShow
import Unsafe.Coerce
newtype SnowflakeMap a = SnowflakeMap
{ forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap :: HashMap (Snowflake a) a
}
deriving stock (SnowflakeMap a -> SnowflakeMap a -> Bool
(SnowflakeMap a -> SnowflakeMap a -> Bool)
-> (SnowflakeMap a -> SnowflakeMap a -> Bool)
-> Eq (SnowflakeMap a)
forall a. Eq a => SnowflakeMap a -> SnowflakeMap a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => SnowflakeMap a -> SnowflakeMap a -> Bool
== :: SnowflakeMap a -> SnowflakeMap a -> Bool
$c/= :: forall a. Eq a => SnowflakeMap a -> SnowflakeMap a -> Bool
/= :: SnowflakeMap a -> SnowflakeMap a -> Bool
Eq, Typeable (SnowflakeMap a)
Typeable (SnowflakeMap a)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SnowflakeMap a -> c (SnowflakeMap a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SnowflakeMap a))
-> (SnowflakeMap a -> Constr)
-> (SnowflakeMap a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (SnowflakeMap a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SnowflakeMap a)))
-> ((forall b. Data b => b -> b)
-> SnowflakeMap a -> SnowflakeMap a)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r)
-> (forall u.
(forall d. Data d => d -> u) -> SnowflakeMap a -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> SnowflakeMap a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a))
-> Data (SnowflakeMap a)
SnowflakeMap a -> Constr
SnowflakeMap a -> DataType
(forall b. Data b => b -> b) -> SnowflakeMap a -> SnowflakeMap a
forall {a}. Data a => Typeable (SnowflakeMap a)
forall a. Data a => SnowflakeMap a -> Constr
forall a. Data a => SnowflakeMap a -> DataType
forall a.
Data a =>
(forall b. Data b => b -> b) -> SnowflakeMap a -> SnowflakeMap a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> SnowflakeMap a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> SnowflakeMap a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SnowflakeMap a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SnowflakeMap a -> c (SnowflakeMap a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (SnowflakeMap a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SnowflakeMap 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) -> SnowflakeMap a -> u
forall u. (forall d. Data d => d -> u) -> SnowflakeMap a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SnowflakeMap a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SnowflakeMap a -> c (SnowflakeMap a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (SnowflakeMap a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SnowflakeMap a))
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SnowflakeMap a -> c (SnowflakeMap a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SnowflakeMap a -> c (SnowflakeMap a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SnowflakeMap a)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SnowflakeMap a)
$ctoConstr :: forall a. Data a => SnowflakeMap a -> Constr
toConstr :: SnowflakeMap a -> Constr
$cdataTypeOf :: forall a. Data a => SnowflakeMap a -> DataType
dataTypeOf :: SnowflakeMap a -> DataType
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (SnowflakeMap a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (SnowflakeMap a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SnowflakeMap a))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SnowflakeMap a))
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> SnowflakeMap a -> SnowflakeMap a
gmapT :: (forall b. Data b => b -> b) -> SnowflakeMap a -> SnowflakeMap a
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> SnowflakeMap a -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> SnowflakeMap a -> [u]
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> SnowflakeMap a -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> SnowflakeMap a -> u
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
Data, Eq (SnowflakeMap a)
Eq (SnowflakeMap a)
-> (SnowflakeMap a -> SnowflakeMap a -> Ordering)
-> (SnowflakeMap a -> SnowflakeMap a -> Bool)
-> (SnowflakeMap a -> SnowflakeMap a -> Bool)
-> (SnowflakeMap a -> SnowflakeMap a -> Bool)
-> (SnowflakeMap a -> SnowflakeMap a -> Bool)
-> (SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a)
-> (SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a)
-> Ord (SnowflakeMap a)
SnowflakeMap a -> SnowflakeMap a -> Bool
SnowflakeMap a -> SnowflakeMap a -> Ordering
SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap 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 {a}. Ord a => Eq (SnowflakeMap a)
forall a. Ord a => SnowflakeMap a -> SnowflakeMap a -> Bool
forall a. Ord a => SnowflakeMap a -> SnowflakeMap a -> Ordering
forall a.
Ord a =>
SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
$ccompare :: forall a. Ord a => SnowflakeMap a -> SnowflakeMap a -> Ordering
compare :: SnowflakeMap a -> SnowflakeMap a -> Ordering
$c< :: forall a. Ord a => SnowflakeMap a -> SnowflakeMap a -> Bool
< :: SnowflakeMap a -> SnowflakeMap a -> Bool
$c<= :: forall a. Ord a => SnowflakeMap a -> SnowflakeMap a -> Bool
<= :: SnowflakeMap a -> SnowflakeMap a -> Bool
$c> :: forall a. Ord a => SnowflakeMap a -> SnowflakeMap a -> Bool
> :: SnowflakeMap a -> SnowflakeMap a -> Bool
$c>= :: forall a. Ord a => SnowflakeMap a -> SnowflakeMap a -> Bool
>= :: SnowflakeMap a -> SnowflakeMap a -> Bool
$cmax :: forall a.
Ord a =>
SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
max :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
$cmin :: forall a.
Ord a =>
SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
min :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
Ord, Int -> SnowflakeMap a -> ShowS
[SnowflakeMap a] -> ShowS
SnowflakeMap a -> String
(Int -> SnowflakeMap a -> ShowS)
-> (SnowflakeMap a -> String)
-> ([SnowflakeMap a] -> ShowS)
-> Show (SnowflakeMap a)
forall a. Show a => Int -> SnowflakeMap a -> ShowS
forall a. Show a => [SnowflakeMap a] -> ShowS
forall a. Show a => SnowflakeMap a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> SnowflakeMap a -> ShowS
showsPrec :: Int -> SnowflakeMap a -> ShowS
$cshow :: forall a. Show a => SnowflakeMap a -> String
show :: SnowflakeMap a -> String
$cshowList :: forall a. Show a => [SnowflakeMap a] -> ShowS
showList :: [SnowflakeMap a] -> ShowS
Show)
deriving (Int -> SnowflakeMap a -> Text
Int -> SnowflakeMap a -> Builder
Int -> SnowflakeMap a -> Text
[SnowflakeMap a] -> Text
[SnowflakeMap a] -> Builder
[SnowflakeMap a] -> Text
SnowflakeMap a -> Text
SnowflakeMap a -> Builder
SnowflakeMap a -> Text
(Int -> SnowflakeMap a -> Builder)
-> (SnowflakeMap a -> Builder)
-> ([SnowflakeMap a] -> Builder)
-> (Int -> SnowflakeMap a -> Text)
-> (SnowflakeMap a -> Text)
-> ([SnowflakeMap a] -> Text)
-> (Int -> SnowflakeMap a -> Text)
-> (SnowflakeMap a -> Text)
-> ([SnowflakeMap a] -> Text)
-> TextShow (SnowflakeMap a)
forall a. Show a => Int -> SnowflakeMap a -> Text
forall a. Show a => Int -> SnowflakeMap a -> Builder
forall a. Show a => Int -> SnowflakeMap a -> Text
forall a. Show a => [SnowflakeMap a] -> Text
forall a. Show a => [SnowflakeMap a] -> Builder
forall a. Show a => [SnowflakeMap a] -> Text
forall a. Show a => SnowflakeMap a -> Text
forall a. Show a => SnowflakeMap a -> Builder
forall a. Show a => SnowflakeMap a -> Text
forall a.
(Int -> a -> Builder)
-> (a -> Builder)
-> ([a] -> Builder)
-> (Int -> a -> Text)
-> (a -> Text)
-> ([a] -> Text)
-> (Int -> a -> Text)
-> (a -> Text)
-> ([a] -> Text)
-> TextShow a
$cshowbPrec :: forall a. Show a => Int -> SnowflakeMap a -> Builder
showbPrec :: Int -> SnowflakeMap a -> Builder
$cshowb :: forall a. Show a => SnowflakeMap a -> Builder
showb :: SnowflakeMap a -> Builder
$cshowbList :: forall a. Show a => [SnowflakeMap a] -> Builder
showbList :: [SnowflakeMap a] -> Builder
$cshowtPrec :: forall a. Show a => Int -> SnowflakeMap a -> Text
showtPrec :: Int -> SnowflakeMap a -> Text
$cshowt :: forall a. Show a => SnowflakeMap a -> Text
showt :: SnowflakeMap a -> Text
$cshowtList :: forall a. Show a => [SnowflakeMap a] -> Text
showtList :: [SnowflakeMap a] -> Text
$cshowtlPrec :: forall a. Show a => Int -> SnowflakeMap a -> Text
showtlPrec :: Int -> SnowflakeMap a -> Text
$cshowtl :: forall a. Show a => SnowflakeMap a -> Text
showtl :: SnowflakeMap a -> Text
$cshowtlList :: forall a. Show a => [SnowflakeMap a] -> Text
showtlList :: [SnowflakeMap a] -> Text
TextShow) via FromStringShow (SnowflakeMap a)
deriving newtype (Int -> [Item (SnowflakeMap a)] -> SnowflakeMap a
[Item (SnowflakeMap a)] -> SnowflakeMap a
SnowflakeMap a -> [Item (SnowflakeMap a)]
([Item (SnowflakeMap a)] -> SnowflakeMap a)
-> (Int -> [Item (SnowflakeMap a)] -> SnowflakeMap a)
-> (SnowflakeMap a -> [Item (SnowflakeMap a)])
-> IsList (SnowflakeMap a)
forall a. Int -> [Item (SnowflakeMap a)] -> SnowflakeMap a
forall a. [Item (SnowflakeMap a)] -> SnowflakeMap a
forall a. SnowflakeMap a -> [Item (SnowflakeMap a)]
forall l.
([Item l] -> l)
-> (Int -> [Item l] -> l) -> (l -> [Item l]) -> IsList l
$cfromList :: forall a. [Item (SnowflakeMap a)] -> SnowflakeMap a
fromList :: [Item (SnowflakeMap a)] -> SnowflakeMap a
$cfromListN :: forall a. Int -> [Item (SnowflakeMap a)] -> SnowflakeMap a
fromListN :: Int -> [Item (SnowflakeMap a)] -> SnowflakeMap a
$ctoList :: forall a. SnowflakeMap a -> [Item (SnowflakeMap a)]
toList :: SnowflakeMap a -> [Item (SnowflakeMap a)]
IsList, NonEmpty (SnowflakeMap a) -> SnowflakeMap a
SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
(SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a)
-> (NonEmpty (SnowflakeMap a) -> SnowflakeMap a)
-> (forall b. Integral b => b -> SnowflakeMap a -> SnowflakeMap a)
-> Semigroup (SnowflakeMap a)
forall b. Integral b => b -> SnowflakeMap a -> SnowflakeMap a
forall a. NonEmpty (SnowflakeMap a) -> SnowflakeMap a
forall a. SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
forall a b. Integral b => b -> SnowflakeMap a -> SnowflakeMap a
$c<> :: forall a. SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
<> :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
$csconcat :: forall a. NonEmpty (SnowflakeMap a) -> SnowflakeMap a
sconcat :: NonEmpty (SnowflakeMap a) -> SnowflakeMap a
$cstimes :: forall a b. Integral b => b -> SnowflakeMap a -> SnowflakeMap a
stimes :: forall b. Integral b => b -> SnowflakeMap a -> SnowflakeMap a
Semigroup, Semigroup (SnowflakeMap a)
SnowflakeMap a
Semigroup (SnowflakeMap a)
-> SnowflakeMap a
-> (SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a)
-> ([SnowflakeMap a] -> SnowflakeMap a)
-> Monoid (SnowflakeMap a)
[SnowflakeMap a] -> SnowflakeMap a
SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
forall a. Semigroup (SnowflakeMap a)
forall a. SnowflakeMap a
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall a. [SnowflakeMap a] -> SnowflakeMap a
forall a. SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
$cmempty :: forall a. SnowflakeMap a
mempty :: SnowflakeMap a
$cmappend :: forall a. SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
mappend :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
$cmconcat :: forall a. [SnowflakeMap a] -> SnowflakeMap a
mconcat :: [SnowflakeMap a] -> SnowflakeMap a
Monoid)
deriving newtype (Eq (SnowflakeMap a)
Eq (SnowflakeMap a)
-> (Int -> SnowflakeMap a -> Int)
-> (SnowflakeMap a -> Int)
-> Hashable (SnowflakeMap a)
Int -> SnowflakeMap a -> Int
SnowflakeMap a -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
forall {a}. Hashable a => Eq (SnowflakeMap a)
forall a. Hashable a => Int -> SnowflakeMap a -> Int
forall a. Hashable a => SnowflakeMap a -> Int
$chashWithSalt :: forall a. Hashable a => Int -> SnowflakeMap a -> Int
hashWithSalt :: Int -> SnowflakeMap a -> Int
$chash :: forall a. Hashable a => SnowflakeMap a -> Int
hash :: SnowflakeMap a -> Int
Hashable)
instance Functor SnowflakeMap where
fmap :: forall a b. (a -> b) -> SnowflakeMap a -> SnowflakeMap b
fmap a -> b
f = HashMap (Snowflake b) b -> SnowflakeMap b
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake b) b -> SnowflakeMap b)
-> (SnowflakeMap a -> HashMap (Snowflake b) b)
-> SnowflakeMap a
-> SnowflakeMap b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HashMap (Snowflake a) b -> HashMap (Snowflake b) b
forall a v b. HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap (HashMap (Snowflake a) b -> HashMap (Snowflake b) b)
-> (SnowflakeMap a -> HashMap (Snowflake a) b)
-> SnowflakeMap a
-> HashMap (Snowflake b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> HashMap (Snowflake a) a -> HashMap (Snowflake a) b
forall a b.
(a -> b) -> HashMap (Snowflake a) a -> HashMap (Snowflake a) b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f (HashMap (Snowflake a) a -> HashMap (Snowflake a) b)
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> HashMap (Snowflake a) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
instance Foldable SnowflakeMap where
foldr :: forall a b. (a -> b -> b) -> b -> SnowflakeMap a -> b
foldr a -> b -> b
f b
b = (a -> b -> b) -> b -> HashMap (Snowflake a) a -> b
forall a b. (a -> b -> b) -> b -> HashMap (Snowflake a) a -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
Prelude.foldr a -> b -> b
f b
b (HashMap (Snowflake a) a -> b)
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
instance Traversable SnowflakeMap where
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> SnowflakeMap a -> f (SnowflakeMap b)
traverse a -> f b
f = (HashMap (Snowflake a) b -> SnowflakeMap b)
-> f (HashMap (Snowflake a) b) -> f (SnowflakeMap b)
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (HashMap (Snowflake b) b -> SnowflakeMap b
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake b) b -> SnowflakeMap b)
-> (HashMap (Snowflake a) b -> HashMap (Snowflake b) b)
-> HashMap (Snowflake a) b
-> SnowflakeMap b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HashMap (Snowflake a) b -> HashMap (Snowflake b) b
forall a v b. HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap) (f (HashMap (Snowflake a) b) -> f (SnowflakeMap b))
-> (SnowflakeMap a -> f (HashMap (Snowflake a) b))
-> SnowflakeMap a
-> f (SnowflakeMap b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> f b)
-> HashMap (Snowflake a) a -> f (HashMap (Snowflake a) b)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> HashMap (Snowflake a) a -> f (HashMap (Snowflake a) b)
traverse a -> f b
f (HashMap (Snowflake a) a -> f (HashMap (Snowflake a) b))
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> f (HashMap (Snowflake a) b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
type instance Index (SnowflakeMap a) = Snowflake a
type instance IxValue (SnowflakeMap a) = a
_SnowflakeMap ::
( Iso
(SnowflakeMap a)
(SnowflakeMap a1)
(HashMap (Snowflake a) a)
(HashMap (Snowflake a1) a1)
)
_SnowflakeMap :: forall a a1.
Iso
(SnowflakeMap a)
(SnowflakeMap a1)
(HashMap (Snowflake a) a)
(HashMap (Snowflake a1) a1)
_SnowflakeMap = (SnowflakeMap a -> HashMap (Snowflake a) a)
-> (HashMap (Snowflake a1) a1 -> SnowflakeMap a1)
-> Iso
(SnowflakeMap a)
(SnowflakeMap a1)
(HashMap (Snowflake a) a)
(HashMap (Snowflake a1) a1)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap HashMap (Snowflake a1) a1 -> SnowflakeMap a1
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap
instance Ixed (SnowflakeMap a) where
ix :: Index (SnowflakeMap a)
-> Optic'
(IxKind (SnowflakeMap a))
NoIx
(SnowflakeMap a)
(IxValue (SnowflakeMap a))
ix Index (SnowflakeMap a)
i = Iso
(SnowflakeMap a)
(SnowflakeMap a)
(HashMap (Snowflake a) a)
(HashMap (Snowflake a) a)
forall a a1.
Iso
(SnowflakeMap a)
(SnowflakeMap a1)
(HashMap (Snowflake a) a)
(HashMap (Snowflake a1) a1)
_SnowflakeMap Iso
(SnowflakeMap a)
(SnowflakeMap a)
(HashMap (Snowflake a) a)
(HashMap (Snowflake a) a)
-> Optic
An_AffineTraversal
NoIx
(HashMap (Snowflake a) a)
(HashMap (Snowflake a) a)
a
a
-> Optic
An_AffineTraversal NoIx (SnowflakeMap a) (SnowflakeMap a) a a
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Index (HashMap (Snowflake a) a)
-> Optic'
(IxKind (HashMap (Snowflake a) a))
NoIx
(HashMap (Snowflake a) a)
(IxValue (HashMap (Snowflake a) a))
forall m. Ixed m => Index m -> Optic' (IxKind m) NoIx m (IxValue m)
ix Index (HashMap (Snowflake a) a)
Index (SnowflakeMap a)
i
{-# INLINE ix #-}
instance At (SnowflakeMap a) where
at :: Index (SnowflakeMap a)
-> Lens' (SnowflakeMap a) (Maybe (IxValue (SnowflakeMap a)))
at Index (SnowflakeMap a)
i = Iso
(SnowflakeMap a)
(SnowflakeMap a)
(HashMap (Snowflake a) a)
(HashMap (Snowflake a) a)
forall a a1.
Iso
(SnowflakeMap a)
(SnowflakeMap a1)
(HashMap (Snowflake a) a)
(HashMap (Snowflake a1) a1)
_SnowflakeMap Iso
(SnowflakeMap a)
(SnowflakeMap a)
(HashMap (Snowflake a) a)
(HashMap (Snowflake a) a)
-> Optic
A_Lens
NoIx
(HashMap (Snowflake a) a)
(HashMap (Snowflake a) a)
(Maybe a)
(Maybe a)
-> Optic
A_Lens NoIx (SnowflakeMap a) (SnowflakeMap a) (Maybe a) (Maybe a)
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Index (HashMap (Snowflake a) a)
-> Lens'
(HashMap (Snowflake a) a)
(Maybe (IxValue (HashMap (Snowflake a) a)))
forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at Index (HashMap (Snowflake a) a)
Index (SnowflakeMap a)
i
{-# INLINE at #-}
overSM :: (HashMap (Snowflake a) a -> HashMap (Snowflake b) b) -> SnowflakeMap a -> SnowflakeMap b
overSM :: forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM HashMap (Snowflake a) a -> HashMap (Snowflake b) b
f = HashMap (Snowflake b) b -> SnowflakeMap b
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake b) b -> SnowflakeMap b)
-> (SnowflakeMap a -> HashMap (Snowflake b) b)
-> SnowflakeMap a
-> SnowflakeMap b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HashMap (Snowflake a) a -> HashMap (Snowflake b) b
f (HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> HashMap (Snowflake b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE overSM #-}
coerceSnowflakeMap :: HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap :: forall a v b. HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap = HashMap (Snowflake a) v -> HashMap (Snowflake b) v
forall a b. a -> b
unsafeCoerce
{-# INLINEABLE coerceSnowflakeMap #-}
empty :: SnowflakeMap a
empty :: forall a. SnowflakeMap a
empty = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap HashMap (Snowflake a) a
forall k v. HashMap k v
SH.empty
{-# INLINEABLE empty #-}
singleton :: HasID' a => a -> SnowflakeMap a
singleton :: forall a. HasID' a => a -> SnowflakeMap a
singleton a
v = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a) a -> SnowflakeMap a)
-> HashMap (Snowflake a) a -> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ Snowflake a -> a -> HashMap (Snowflake a) a
forall k v. Hashable k => k -> v -> HashMap k v
SH.singleton (a -> Snowflake a
forall b a. HasID b a => a -> Snowflake b
getID a
v) a
v
{-# INLINEABLE singleton #-}
null :: SnowflakeMap a -> Bool
null :: forall a. SnowflakeMap a -> Bool
null = HashMap (Snowflake a) a -> Bool
forall k v. HashMap k v -> Bool
SH.null (HashMap (Snowflake a) a -> Bool)
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE null #-}
size :: SnowflakeMap a -> Int
size :: forall a. SnowflakeMap a -> Int
size = HashMap (Snowflake a) a -> Int
forall k v. HashMap k v -> Int
SH.size (HashMap (Snowflake a) a -> Int)
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE size #-}
member :: Snowflake a -> SnowflakeMap a -> Bool
member :: forall a. Snowflake a -> SnowflakeMap a -> Bool
member Snowflake a
k = Snowflake a -> HashMap (Snowflake a) a -> Bool
forall k a. (Eq k, Hashable k) => k -> HashMap k a -> Bool
SH.member Snowflake a
k (HashMap (Snowflake a) a -> Bool)
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE member #-}
lookup :: Snowflake a -> SnowflakeMap a -> Maybe a
lookup :: forall a. Snowflake a -> SnowflakeMap a -> Maybe a
lookup Snowflake a
k = Snowflake a -> HashMap (Snowflake a) a -> Maybe a
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
SH.lookup Snowflake a
k (HashMap (Snowflake a) a -> Maybe a)
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> Maybe a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE lookup #-}
lookupDefault :: a -> Snowflake a -> SnowflakeMap a -> a
lookupDefault :: forall a. a -> Snowflake a -> SnowflakeMap a -> a
lookupDefault a
d Snowflake a
k = a -> Snowflake a -> HashMap (Snowflake a) a -> a
forall k v. (Eq k, Hashable k) => v -> k -> HashMap k v -> v
SH.lookupDefault a
d Snowflake a
k (HashMap (Snowflake a) a -> a)
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE lookupDefault #-}
(!) :: SnowflakeMap a -> Snowflake a -> a
! :: forall a. SnowflakeMap a -> Snowflake a -> a
(!) SnowflakeMap a
m Snowflake a
k = SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m HashMap (Snowflake a) a -> Snowflake a -> a
forall k v.
(Eq k, Hashable k, HasCallStack) =>
HashMap k v -> k -> v
SH.! Snowflake a
k
{-# INLINEABLE (!) #-}
infixl 9 !
insert :: HasID' a => a -> SnowflakeMap a -> SnowflakeMap a
insert :: forall a. HasID' a => a -> SnowflakeMap a -> SnowflakeMap a
insert a
v = (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ Snowflake a
-> a -> HashMap (Snowflake a) a -> HashMap (Snowflake a) a
forall k v.
(Eq k, Hashable k) =>
k -> v -> HashMap k v -> HashMap k v
SH.insert (a -> Snowflake a
forall b a. HasID b a => a -> Snowflake b
getID a
v) a
v
{-# INLINEABLE insert #-}
insertWith :: HasID' a => (a -> a -> a) -> a -> SnowflakeMap a -> SnowflakeMap a
insertWith :: forall a.
HasID' a =>
(a -> a -> a) -> a -> SnowflakeMap a -> SnowflakeMap a
insertWith a -> a -> a
f a
v = (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ (a -> a -> a)
-> Snowflake a
-> a
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
forall k v.
(Eq k, Hashable k) =>
(v -> v -> v) -> k -> v -> HashMap k v -> HashMap k v
SH.insertWith a -> a -> a
f (a -> Snowflake a
forall b a. HasID b a => a -> Snowflake b
getID a
v) a
v
{-# INLINEABLE insertWith #-}
delete :: Snowflake a -> SnowflakeMap a -> SnowflakeMap a
delete :: forall a. Snowflake a -> SnowflakeMap a -> SnowflakeMap a
delete Snowflake a
k = (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ Snowflake a -> HashMap (Snowflake a) a -> HashMap (Snowflake a) a
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v
SH.delete Snowflake a
k
{-# INLINEABLE delete #-}
adjust :: (a -> a) -> Snowflake a -> SnowflakeMap a -> SnowflakeMap a
adjust :: forall a.
(a -> a) -> Snowflake a -> SnowflakeMap a -> SnowflakeMap a
adjust a -> a
f Snowflake a
k = (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ (a -> a)
-> Snowflake a
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
forall k v.
(Eq k, Hashable k) =>
(v -> v) -> k -> HashMap k v -> HashMap k v
SH.adjust a -> a
f Snowflake a
k
{-# INLINEABLE adjust #-}
update :: (a -> Maybe a) -> Snowflake a -> SnowflakeMap a -> SnowflakeMap a
update :: forall a.
(a -> Maybe a) -> Snowflake a -> SnowflakeMap a -> SnowflakeMap a
update a -> Maybe a
f Snowflake a
k = (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ (a -> Maybe a)
-> Snowflake a
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
forall k a.
(Eq k, Hashable k) =>
(a -> Maybe a) -> k -> HashMap k a -> HashMap k a
SH.update a -> Maybe a
f Snowflake a
k
{-# INLINEABLE update #-}
alter :: (Maybe a -> Maybe a) -> Snowflake a -> SnowflakeMap a -> SnowflakeMap a
alter :: forall a.
(Maybe a -> Maybe a)
-> Snowflake a -> SnowflakeMap a -> SnowflakeMap a
alter Maybe a -> Maybe a
f Snowflake a
k = (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ (Maybe a -> Maybe a)
-> Snowflake a
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
forall k v.
(Eq k, Hashable k) =>
(Maybe v -> Maybe v) -> k -> HashMap k v -> HashMap k v
SH.alter Maybe a -> Maybe a
f Snowflake a
k
{-# INLINEABLE alter #-}
union :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
union :: forall a. SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
union SnowflakeMap a
m SnowflakeMap a
m' = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a) a -> SnowflakeMap a)
-> HashMap (Snowflake a) a -> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ HashMap (Snowflake a) a
-> HashMap (Snowflake a) a -> HashMap (Snowflake a) a
forall k v.
(Eq k, Hashable k) =>
HashMap k v -> HashMap k v -> HashMap k v
SH.union (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m) (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m')
{-# INLINEABLE union #-}
unionWith :: (a -> a -> a) -> SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
unionWith :: forall a.
(a -> a -> a) -> SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
unionWith a -> a -> a
f SnowflakeMap a
m SnowflakeMap a
m' = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a) a -> SnowflakeMap a)
-> HashMap (Snowflake a) a -> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ (a -> a -> a)
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
forall k v.
(Eq k, Hashable k) =>
(v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v
SH.unionWith a -> a -> a
f (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m) (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m')
{-# INLINEABLE unionWith #-}
unionWithKey :: (Snowflake a -> a -> a -> a) -> SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
unionWithKey :: forall a.
(Snowflake a -> a -> a -> a)
-> SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
unionWithKey Snowflake a -> a -> a -> a
f SnowflakeMap a
m SnowflakeMap a
m' = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a) a -> SnowflakeMap a)
-> HashMap (Snowflake a) a -> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ (Snowflake a -> a -> a -> a)
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
forall k v.
(Eq k, Hashable k) =>
(k -> v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v
SH.unionWithKey Snowflake a -> a -> a -> a
f (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m) (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m')
{-# INLINEABLE unionWithKey #-}
unions :: [SnowflakeMap a] -> SnowflakeMap a
unions :: forall a. [SnowflakeMap a] -> SnowflakeMap a
unions = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a) a -> SnowflakeMap a)
-> ([SnowflakeMap a] -> HashMap (Snowflake a) a)
-> [SnowflakeMap a]
-> SnowflakeMap a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [HashMap (Snowflake a) a] -> HashMap (Snowflake a) a
forall k v. (Eq k, Hashable k) => [HashMap k v] -> HashMap k v
SH.unions ([HashMap (Snowflake a) a] -> HashMap (Snowflake a) a)
-> ([SnowflakeMap a] -> [HashMap (Snowflake a) a])
-> [SnowflakeMap a]
-> HashMap (Snowflake a) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SnowflakeMap a -> HashMap (Snowflake a) a)
-> [SnowflakeMap a] -> [HashMap (Snowflake a) a]
forall a b. (a -> b) -> [a] -> [b]
Prelude.map SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE unions #-}
map :: (a1 -> a2) -> SnowflakeMap a1 -> SnowflakeMap a2
map :: forall a b. (a -> b) -> SnowflakeMap a -> SnowflakeMap b
map a1 -> a2
f = (HashMap (Snowflake a1) a1 -> HashMap (Snowflake a2) a2)
-> SnowflakeMap a1 -> SnowflakeMap a2
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a1) a1 -> HashMap (Snowflake a2) a2)
-> SnowflakeMap a1 -> SnowflakeMap a2)
-> (HashMap (Snowflake a1) a1 -> HashMap (Snowflake a2) a2)
-> SnowflakeMap a1
-> SnowflakeMap a2
forall a b. (a -> b) -> a -> b
$ HashMap (Snowflake a1) a2 -> HashMap (Snowflake a2) a2
forall a v b. HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap (HashMap (Snowflake a1) a2 -> HashMap (Snowflake a2) a2)
-> (HashMap (Snowflake a1) a1 -> HashMap (Snowflake a1) a2)
-> HashMap (Snowflake a1) a1
-> HashMap (Snowflake a2) a2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a1 -> a2)
-> HashMap (Snowflake a1) a1 -> HashMap (Snowflake a1) a2
forall v1 v2 k. (v1 -> v2) -> HashMap k v1 -> HashMap k v2
SH.map a1 -> a2
f
{-# INLINEABLE map #-}
mapWithKey :: (Snowflake a1 -> a1 -> a2) -> SnowflakeMap a1 -> SnowflakeMap a2
mapWithKey :: forall a1 a2.
(Snowflake a1 -> a1 -> a2) -> SnowflakeMap a1 -> SnowflakeMap a2
mapWithKey Snowflake a1 -> a1 -> a2
f = (HashMap (Snowflake a1) a1 -> HashMap (Snowflake a2) a2)
-> SnowflakeMap a1 -> SnowflakeMap a2
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a1) a1 -> HashMap (Snowflake a2) a2)
-> SnowflakeMap a1 -> SnowflakeMap a2)
-> (HashMap (Snowflake a1) a1 -> HashMap (Snowflake a2) a2)
-> SnowflakeMap a1
-> SnowflakeMap a2
forall a b. (a -> b) -> a -> b
$ HashMap (Snowflake a1) a2 -> HashMap (Snowflake a2) a2
forall a v b. HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap (HashMap (Snowflake a1) a2 -> HashMap (Snowflake a2) a2)
-> (HashMap (Snowflake a1) a1 -> HashMap (Snowflake a1) a2)
-> HashMap (Snowflake a1) a1
-> HashMap (Snowflake a2) a2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Snowflake a1 -> a1 -> a2)
-> HashMap (Snowflake a1) a1 -> HashMap (Snowflake a1) a2
forall k v1 v2. (k -> v1 -> v2) -> HashMap k v1 -> HashMap k v2
SH.mapWithKey Snowflake a1 -> a1 -> a2
f
{-# INLINEABLE mapWithKey #-}
traverseWithKey :: Applicative f => (Snowflake a1 -> a1 -> f a2) -> SnowflakeMap a1 -> f (SnowflakeMap a2)
traverseWithKey :: forall (f :: * -> *) a1 a2.
Applicative f =>
(Snowflake a1 -> a1 -> f a2)
-> SnowflakeMap a1 -> f (SnowflakeMap a2)
traverseWithKey Snowflake a1 -> a1 -> f a2
f = (HashMap (Snowflake a1) a2 -> SnowflakeMap a2)
-> f (HashMap (Snowflake a1) a2) -> f (SnowflakeMap a2)
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (HashMap (Snowflake a2) a2 -> SnowflakeMap a2
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a2) a2 -> SnowflakeMap a2)
-> (HashMap (Snowflake a1) a2 -> HashMap (Snowflake a2) a2)
-> HashMap (Snowflake a1) a2
-> SnowflakeMap a2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HashMap (Snowflake a1) a2 -> HashMap (Snowflake a2) a2
forall a v b. HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap) (f (HashMap (Snowflake a1) a2) -> f (SnowflakeMap a2))
-> (SnowflakeMap a1 -> f (HashMap (Snowflake a1) a2))
-> SnowflakeMap a1
-> f (SnowflakeMap a2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Snowflake a1 -> a1 -> f a2)
-> HashMap (Snowflake a1) a1 -> f (HashMap (Snowflake a1) a2)
forall (f :: * -> *) k v1 v2.
Applicative f =>
(k -> v1 -> f v2) -> HashMap k v1 -> f (HashMap k v2)
SH.traverseWithKey Snowflake a1 -> a1 -> f a2
f (HashMap (Snowflake a1) a1 -> f (HashMap (Snowflake a1) a2))
-> (SnowflakeMap a1 -> HashMap (Snowflake a1) a1)
-> SnowflakeMap a1
-> f (HashMap (Snowflake a1) a2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a1 -> HashMap (Snowflake a1) a1
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE traverseWithKey #-}
difference :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
difference :: forall a. SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
difference SnowflakeMap a
m SnowflakeMap a
m' = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a) a -> SnowflakeMap a)
-> HashMap (Snowflake a) a -> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ HashMap (Snowflake a) a
-> HashMap (Snowflake a) a -> HashMap (Snowflake a) a
forall k v w.
(Eq k, Hashable k) =>
HashMap k v -> HashMap k w -> HashMap k v
SH.difference (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m) (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m')
{-# INLINEABLE difference #-}
differenceWith :: (a -> a -> Maybe a) -> SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
differenceWith :: forall a.
(a -> a -> Maybe a)
-> SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
differenceWith a -> a -> Maybe a
f SnowflakeMap a
m SnowflakeMap a
m' = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a) a -> SnowflakeMap a)
-> HashMap (Snowflake a) a -> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ (a -> a -> Maybe a)
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
forall k v w.
(Eq k, Hashable k) =>
(v -> w -> Maybe v) -> HashMap k v -> HashMap k w -> HashMap k v
SH.differenceWith a -> a -> Maybe a
f (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m) (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m')
{-# INLINEABLE differenceWith #-}
intersection :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
intersection :: forall a. SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
intersection SnowflakeMap a
m SnowflakeMap a
m' = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a) a -> SnowflakeMap a)
-> HashMap (Snowflake a) a -> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ HashMap (Snowflake a) a
-> HashMap (Snowflake a) a -> HashMap (Snowflake a) a
forall k v w.
(Eq k, Hashable k) =>
HashMap k v -> HashMap k w -> HashMap k v
SH.intersection (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m) (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m')
{-# INLINEABLE intersection #-}
intersectionWith :: (a -> a -> b) -> SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap b
intersectionWith :: forall a b.
(a -> a -> b) -> SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap b
intersectionWith a -> a -> b
f SnowflakeMap a
m SnowflakeMap a
m' = HashMap (Snowflake b) b -> SnowflakeMap b
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake b) b -> SnowflakeMap b)
-> (HashMap (Snowflake a) b -> HashMap (Snowflake b) b)
-> HashMap (Snowflake a) b
-> SnowflakeMap b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HashMap (Snowflake a) b -> HashMap (Snowflake b) b
forall a v b. HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap (HashMap (Snowflake a) b -> SnowflakeMap b)
-> HashMap (Snowflake a) b -> SnowflakeMap b
forall a b. (a -> b) -> a -> b
$ (a -> a -> b)
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) b
forall k v1 v2 v3.
(Eq k, Hashable k) =>
(v1 -> v2 -> v3) -> HashMap k v1 -> HashMap k v2 -> HashMap k v3
SH.intersectionWith a -> a -> b
f (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m) (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m')
{-# INLINEABLE intersectionWith #-}
intersectionWithKey :: (Snowflake a -> a -> a -> b) -> SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap b
intersectionWithKey :: forall a b.
(Snowflake a -> a -> a -> b)
-> SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap b
intersectionWithKey Snowflake a -> a -> a -> b
f SnowflakeMap a
m SnowflakeMap a
m' = HashMap (Snowflake b) b -> SnowflakeMap b
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake b) b -> SnowflakeMap b)
-> (HashMap (Snowflake a) b -> HashMap (Snowflake b) b)
-> HashMap (Snowflake a) b
-> SnowflakeMap b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HashMap (Snowflake a) b -> HashMap (Snowflake b) b
forall a v b. HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap (HashMap (Snowflake a) b -> SnowflakeMap b)
-> HashMap (Snowflake a) b -> SnowflakeMap b
forall a b. (a -> b) -> a -> b
$ (Snowflake a -> a -> a -> b)
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) a
-> HashMap (Snowflake a) b
forall k v1 v2 v3.
(Eq k, Hashable k) =>
(k -> v1 -> v2 -> v3)
-> HashMap k v1 -> HashMap k v2 -> HashMap k v3
SH.intersectionWithKey Snowflake a -> a -> a -> b
f (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m) (SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap a
m')
{-# INLINEABLE intersectionWithKey #-}
foldl' :: (a -> b -> a) -> a -> SnowflakeMap b -> a
foldl' :: forall b a. (b -> a -> b) -> b -> SnowflakeMap a -> b
foldl' a -> b -> a
f a
s SnowflakeMap b
m = (a -> b -> a) -> a -> HashMap (Snowflake b) b -> a
forall a v k. (a -> v -> a) -> a -> HashMap k v -> a
SH.foldl' a -> b -> a
f a
s (HashMap (Snowflake b) b -> a) -> HashMap (Snowflake b) b -> a
forall a b. (a -> b) -> a -> b
$ SnowflakeMap b -> HashMap (Snowflake b) b
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap b
m
{-# INLINEABLE foldl' #-}
foldlWithKey' :: (a -> Snowflake b -> b -> a) -> a -> SnowflakeMap b -> a
foldlWithKey' :: forall a b.
(a -> Snowflake b -> b -> a) -> a -> SnowflakeMap b -> a
foldlWithKey' a -> Snowflake b -> b -> a
f a
s SnowflakeMap b
m = (a -> Snowflake b -> b -> a) -> a -> HashMap (Snowflake b) b -> a
forall a k v. (a -> k -> v -> a) -> a -> HashMap k v -> a
SH.foldlWithKey' a -> Snowflake b -> b -> a
f a
s (HashMap (Snowflake b) b -> a) -> HashMap (Snowflake b) b -> a
forall a b. (a -> b) -> a -> b
$ SnowflakeMap b -> HashMap (Snowflake b) b
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap b
m
{-# INLINEABLE foldlWithKey' #-}
foldr :: (b -> a -> a) -> a -> SnowflakeMap b -> a
foldr :: forall a b. (a -> b -> b) -> b -> SnowflakeMap a -> b
foldr b -> a -> a
f a
s SnowflakeMap b
m = (b -> a -> a) -> a -> HashMap (Snowflake b) b -> a
forall v a k. (v -> a -> a) -> a -> HashMap k v -> a
SH.foldr b -> a -> a
f a
s (HashMap (Snowflake b) b -> a) -> HashMap (Snowflake b) b -> a
forall a b. (a -> b) -> a -> b
$ SnowflakeMap b -> HashMap (Snowflake b) b
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap b
m
{-# INLINEABLE foldr #-}
foldrWithKey :: (Snowflake b -> b -> a -> a) -> a -> SnowflakeMap b -> a
foldrWithKey :: forall b a.
(Snowflake b -> b -> a -> a) -> a -> SnowflakeMap b -> a
foldrWithKey Snowflake b -> b -> a -> a
f a
s SnowflakeMap b
m = (Snowflake b -> b -> a -> a) -> a -> HashMap (Snowflake b) b -> a
forall k v a. (k -> v -> a -> a) -> a -> HashMap k v -> a
SH.foldrWithKey Snowflake b -> b -> a -> a
f a
s (HashMap (Snowflake b) b -> a) -> HashMap (Snowflake b) b -> a
forall a b. (a -> b) -> a -> b
$ SnowflakeMap b -> HashMap (Snowflake b) b
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap SnowflakeMap b
m
{-# INLINEABLE foldrWithKey #-}
filter :: (a -> Bool) -> SnowflakeMap a -> SnowflakeMap a
filter :: forall a. (a -> Bool) -> SnowflakeMap a -> SnowflakeMap a
filter a -> Bool
f = (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ (a -> Bool) -> HashMap (Snowflake a) a -> HashMap (Snowflake a) a
forall v k. (v -> Bool) -> HashMap k v -> HashMap k v
SH.filter a -> Bool
f
{-# INLINEABLE filter #-}
filterWithKey :: (Snowflake a -> a -> Bool) -> SnowflakeMap a -> SnowflakeMap a
filterWithKey :: forall a.
(Snowflake a -> a -> Bool) -> SnowflakeMap a -> SnowflakeMap a
filterWithKey Snowflake a -> a -> Bool
f = (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a -> SnowflakeMap a)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> SnowflakeMap a
forall a b. (a -> b) -> a -> b
$ (Snowflake a -> a -> Bool)
-> HashMap (Snowflake a) a -> HashMap (Snowflake a) a
forall k v. (k -> v -> Bool) -> HashMap k v -> HashMap k v
SH.filterWithKey Snowflake a -> a -> Bool
f
{-# INLINEABLE filterWithKey #-}
mapMaybe :: (a -> Maybe b) -> SnowflakeMap a -> SnowflakeMap b
mapMaybe :: forall a b. (a -> Maybe b) -> SnowflakeMap a -> SnowflakeMap b
mapMaybe a -> Maybe b
f = (HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a
-> SnowflakeMap b
forall a b. (a -> b) -> a -> b
$ HashMap (Snowflake a) b -> HashMap (Snowflake b) b
forall a v b. HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap (HashMap (Snowflake a) b -> HashMap (Snowflake b) b)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake a) b)
-> HashMap (Snowflake a) a
-> HashMap (Snowflake b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> Maybe b)
-> HashMap (Snowflake a) a -> HashMap (Snowflake a) b
forall v1 v2 k. (v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2
SH.mapMaybe a -> Maybe b
f
{-# INLINEABLE mapMaybe #-}
mapMaybeWithKey :: (Snowflake a -> a -> Maybe b) -> SnowflakeMap a -> SnowflakeMap b
mapMaybeWithKey :: forall a b.
(Snowflake a -> a -> Maybe b) -> SnowflakeMap a -> SnowflakeMap b
mapMaybeWithKey Snowflake a -> a -> Maybe b
f = (HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
forall a b.
(HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
overSM ((HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a
-> SnowflakeMap b
forall a b. (a -> b) -> a -> b
$ HashMap (Snowflake a) b -> HashMap (Snowflake b) b
forall a v b. HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap (HashMap (Snowflake a) b -> HashMap (Snowflake b) b)
-> (HashMap (Snowflake a) a -> HashMap (Snowflake a) b)
-> HashMap (Snowflake a) a
-> HashMap (Snowflake b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Snowflake a -> a -> Maybe b)
-> HashMap (Snowflake a) a -> HashMap (Snowflake a) b
forall k v1 v2.
(k -> v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2
SH.mapMaybeWithKey Snowflake a -> a -> Maybe b
f
{-# INLINEABLE mapMaybeWithKey #-}
keys :: SnowflakeMap a -> [Snowflake a]
keys :: forall a. SnowflakeMap a -> [Snowflake a]
keys = HashMap (Snowflake a) a -> [Snowflake a]
forall k v. HashMap k v -> [k]
SH.keys (HashMap (Snowflake a) a -> [Snowflake a])
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> [Snowflake a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE keys #-}
elems :: SnowflakeMap a -> [a]
elems :: forall a. SnowflakeMap a -> [a]
elems = HashMap (Snowflake a) a -> [a]
forall k v. HashMap k v -> [v]
SH.elems (HashMap (Snowflake a) a -> [a])
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE elems #-}
toList :: SnowflakeMap a -> [(Snowflake a, a)]
toList :: forall a. SnowflakeMap a -> [(Snowflake a, a)]
toList = HashMap (Snowflake a) a -> [(Snowflake a, a)]
forall k v. HashMap k v -> [(k, v)]
SH.toList (HashMap (Snowflake a) a -> [(Snowflake a, a)])
-> (SnowflakeMap a -> HashMap (Snowflake a) a)
-> SnowflakeMap a
-> [(Snowflake a, a)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> HashMap (Snowflake a) a
forall a. SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap
{-# INLINEABLE toList #-}
fromList :: HasID' a => [a] -> SnowflakeMap a
fromList :: forall a. HasID' a => [a] -> SnowflakeMap a
fromList = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a) a -> SnowflakeMap a)
-> ([a] -> HashMap (Snowflake a) a) -> [a] -> SnowflakeMap a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(Snowflake a, a)] -> HashMap (Snowflake a) a
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
SH.fromList ([(Snowflake a, a)] -> HashMap (Snowflake a) a)
-> ([a] -> [(Snowflake a, a)]) -> [a] -> HashMap (Snowflake a) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> (Snowflake a, a)) -> [a] -> [(Snowflake a, a)]
forall a b. (a -> b) -> [a] -> [b]
Prelude.map (\a
v -> (a -> Snowflake a
forall b a. HasID b a => a -> Snowflake b
getID a
v, a
v))
{-# INLINEABLE fromList #-}
fromListWith :: HasID' a => (a -> a -> a) -> [a] -> SnowflakeMap a
fromListWith :: forall a. HasID' a => (a -> a -> a) -> [a] -> SnowflakeMap a
fromListWith a -> a -> a
f = HashMap (Snowflake a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap (HashMap (Snowflake a) a -> SnowflakeMap a)
-> ([a] -> HashMap (Snowflake a) a) -> [a] -> SnowflakeMap a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> a -> a) -> [(Snowflake a, a)] -> HashMap (Snowflake a) a
forall k v.
(Eq k, Hashable k) =>
(v -> v -> v) -> [(k, v)] -> HashMap k v
SH.fromListWith a -> a -> a
f ([(Snowflake a, a)] -> HashMap (Snowflake a) a)
-> ([a] -> [(Snowflake a, a)]) -> [a] -> HashMap (Snowflake a) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> (Snowflake a, a)) -> [a] -> [(Snowflake a, a)]
forall a b. (a -> b) -> [a] -> [b]
Prelude.map (\a
v -> (a -> Snowflake a
forall b a. HasID b a => a -> Snowflake b
getID a
v, a
v))
{-# INLINEABLE fromListWith #-}
instance (FromJSON a, HasID' a) => FromJSON (SnowflakeMap a) where
parseJSON :: Value -> Parser (SnowflakeMap a)
parseJSON = String
-> (Array -> Parser (SnowflakeMap a))
-> Value
-> Parser (SnowflakeMap a)
forall a. String -> (Array -> Parser a) -> Value -> Parser a
withArray String
"SnowflakeMap" ((Array -> Parser (SnowflakeMap a))
-> Value -> Parser (SnowflakeMap a))
-> (Array -> Parser (SnowflakeMap a))
-> Value
-> Parser (SnowflakeMap a)
forall a b. (a -> b) -> a -> b
$ \Array
l -> do
Vector a
parsed <- (Value -> Parser a) -> Array -> Parser (Vector a)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Vector a -> f (Vector b)
traverse Value -> Parser a
forall a. FromJSON a => Value -> Parser a
parseJSON Array
l
SnowflakeMap a -> Parser (SnowflakeMap a)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SnowflakeMap a -> Parser (SnowflakeMap a))
-> (Vector a -> SnowflakeMap a)
-> Vector a
-> Parser (SnowflakeMap a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> SnowflakeMap a
forall a. HasID' a => [a] -> SnowflakeMap a
Calamity.Internal.SnowflakeMap.fromList ([a] -> SnowflakeMap a)
-> (Vector a -> [a]) -> Vector a -> SnowflakeMap a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector a -> [a]
forall a. Vector a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
F.toList (Vector a -> Parser (SnowflakeMap a))
-> Vector a -> Parser (SnowflakeMap a)
forall a b. (a -> b) -> a -> b
$ Vector a
parsed
instance ToJSON a => ToJSON (SnowflakeMap a) where
toJSON :: SnowflakeMap a -> Value
toJSON = [a] -> Value
forall a. ToJSON a => a -> Value
toJSON ([a] -> Value)
-> (SnowflakeMap a -> [a]) -> SnowflakeMap a -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> [a]
forall a. SnowflakeMap a -> [a]
elems
toEncoding :: SnowflakeMap a -> Encoding
toEncoding = [a] -> Encoding
forall a. ToJSON a => a -> Encoding
toEncoding ([a] -> Encoding)
-> (SnowflakeMap a -> [a]) -> SnowflakeMap a -> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnowflakeMap a -> [a]
forall a. SnowflakeMap a -> [a]
elems