-- | Module for custom instance of Data.HashMap.Strict that decodes from any list of objects that have an id field
module Calamity.Internal.SnowflakeMap where

import Calamity.Internal.Utils ()
import Calamity.Types.Snowflake
import Control.DeepSeq
import Control.Lens.At
import Control.Lens.Iso
import Control.Lens.Wrapped
import Data.Aeson (FromJSON (..), ToJSON (..), withArray)
import Data.Data
import qualified Data.Foldable as F
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as SH
import Data.Hashable
import GHC.Exts (IsList)
import GHC.Generics
import TextShow
import Unsafe.Coerce

newtype SnowflakeMap a = SnowflakeMap
  { SnowflakeMap a -> HashMap (Snowflake a) a
unSnowflakeMap :: HashMap (Snowflake a) a
  }
  deriving stock ((forall x. SnowflakeMap a -> Rep (SnowflakeMap a) x)
-> (forall x. Rep (SnowflakeMap a) x -> SnowflakeMap a)
-> Generic (SnowflakeMap a)
forall x. Rep (SnowflakeMap a) x -> SnowflakeMap a
forall x. SnowflakeMap a -> Rep (SnowflakeMap a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (SnowflakeMap a) x -> SnowflakeMap a
forall a x. SnowflakeMap a -> Rep (SnowflakeMap a) x
$cto :: forall a x. Rep (SnowflakeMap a) x -> SnowflakeMap a
$cfrom :: forall a x. SnowflakeMap a -> Rep (SnowflakeMap a) x
Generic, 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
/= :: SnowflakeMap a -> SnowflakeMap a -> Bool
$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
Eq, Typeable (SnowflakeMap a)
DataType
Constr
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 -> DataType
SnowflakeMap a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (SnowflakeMap a))
(forall b. Data b => b -> b) -> SnowflakeMap a -> SnowflakeMap a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SnowflakeMap a -> c (SnowflakeMap a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SnowflakeMap a)
forall a. Data a => Typeable (SnowflakeMap a)
forall a. Data a => SnowflakeMap a -> DataType
forall a. Data a => SnowflakeMap a -> Constr
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))
$cSnowflakeMap :: Constr
$tSnowflakeMap :: DataType
gmapMo :: (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)
gmapMp :: (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)
gmapM :: (forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> SnowflakeMap a -> m (SnowflakeMap a)
gmapQi :: Int -> (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
gmapQ :: (forall d. Data d => d -> u) -> SnowflakeMap a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> SnowflakeMap a -> [u]
gmapQr :: (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
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SnowflakeMap a -> r
gmapT :: (forall b. Data b => b -> b) -> SnowflakeMap a -> SnowflakeMap a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> SnowflakeMap a -> SnowflakeMap a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> 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))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (SnowflakeMap a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (SnowflakeMap a))
dataTypeOf :: SnowflakeMap a -> DataType
$cdataTypeOf :: forall a. Data a => SnowflakeMap a -> DataType
toConstr :: SnowflakeMap a -> Constr
$ctoConstr :: forall a. Data a => SnowflakeMap a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> 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)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SnowflakeMap a -> 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)
$cp1Data :: forall a. Data a => Typeable (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
min :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
$cmin :: forall a.
Ord a =>
SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
max :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
$cmax :: forall a.
Ord a =>
SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
>= :: 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
$c< :: forall a. Ord a => SnowflakeMap a -> SnowflakeMap a -> Bool
compare :: SnowflakeMap a -> SnowflakeMap a -> Ordering
$ccompare :: forall a. Ord a => SnowflakeMap a -> SnowflakeMap a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (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
showList :: [SnowflakeMap a] -> ShowS
$cshowList :: forall a. Show a => [SnowflakeMap a] -> ShowS
show :: SnowflakeMap a -> String
$cshow :: forall a. Show a => SnowflakeMap a -> String
showsPrec :: Int -> SnowflakeMap a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> SnowflakeMap a -> ShowS
Show)
  deriving (Int -> SnowflakeMap a -> Builder
Int -> SnowflakeMap a -> Text
Int -> SnowflakeMap a -> Text
[SnowflakeMap a] -> Builder
[SnowflakeMap a] -> Text
[SnowflakeMap a] -> Text
SnowflakeMap a -> Builder
SnowflakeMap a -> Text
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 -> Builder
forall a. Show a => Int -> SnowflakeMap a -> Text
forall a. Show a => Int -> 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. 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
showtlList :: [SnowflakeMap a] -> Text
$cshowtlList :: forall a. Show a => [SnowflakeMap a] -> Text
showtl :: SnowflakeMap a -> Text
$cshowtl :: forall a. Show a => SnowflakeMap a -> Text
showtlPrec :: Int -> SnowflakeMap a -> Text
$cshowtlPrec :: forall a. Show a => Int -> SnowflakeMap a -> Text
showtList :: [SnowflakeMap a] -> Text
$cshowtList :: forall a. Show a => [SnowflakeMap a] -> Text
showt :: SnowflakeMap a -> Text
$cshowt :: forall a. Show a => SnowflakeMap a -> Text
showtPrec :: Int -> SnowflakeMap a -> Text
$cshowtPrec :: forall a. Show a => Int -> SnowflakeMap a -> Text
showbList :: [SnowflakeMap a] -> Builder
$cshowbList :: forall a. Show a => [SnowflakeMap a] -> Builder
showb :: SnowflakeMap a -> Builder
$cshowb :: forall a. Show a => SnowflakeMap a -> Builder
showbPrec :: Int -> SnowflakeMap a -> Builder
$cshowbPrec :: forall a. Show a => Int -> SnowflakeMap a -> Builder
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
toList :: SnowflakeMap a -> [Item (SnowflakeMap a)]
$ctoList :: forall a. SnowflakeMap a -> [Item (SnowflakeMap a)]
fromListN :: Int -> [Item (SnowflakeMap a)] -> SnowflakeMap a
$cfromListN :: forall a. Int -> [Item (SnowflakeMap a)] -> SnowflakeMap a
fromList :: [Item (SnowflakeMap a)] -> SnowflakeMap a
$cfromList :: forall a. [Item (SnowflakeMap a)] -> SnowflakeMap a
IsList, b -> SnowflakeMap a -> SnowflakeMap a
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
stimes :: b -> SnowflakeMap a -> SnowflakeMap a
$cstimes :: forall a b. Integral b => b -> SnowflakeMap a -> SnowflakeMap a
sconcat :: NonEmpty (SnowflakeMap a) -> SnowflakeMap a
$csconcat :: forall a. NonEmpty (SnowflakeMap a) -> SnowflakeMap a
<> :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
$c<> :: forall a. SnowflakeMap a -> 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
mconcat :: [SnowflakeMap a] -> SnowflakeMap a
$cmconcat :: forall a. [SnowflakeMap a] -> SnowflakeMap a
mappend :: SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
$cmappend :: forall a. SnowflakeMap a -> SnowflakeMap a -> SnowflakeMap a
mempty :: SnowflakeMap a
$cmempty :: forall a. SnowflakeMap a
$cp1Monoid :: forall a. Semigroup (SnowflakeMap a)
Monoid)
  deriving newtype (SnowflakeMap a -> ()
(SnowflakeMap a -> ()) -> NFData (SnowflakeMap a)
forall a. NFData a => SnowflakeMap a -> ()
forall a. (a -> ()) -> NFData a
rnf :: SnowflakeMap a -> ()
$crnf :: forall a. NFData a => SnowflakeMap a -> ()
NFData, 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
hash :: SnowflakeMap a -> Int
$chash :: forall a. Hashable a => SnowflakeMap a -> Int
hashWithSalt :: Int -> SnowflakeMap a -> Int
$chashWithSalt :: forall a. Hashable a => Int -> SnowflakeMap a -> Int
$cp1Hashable :: forall a. Hashable a => Eq (SnowflakeMap a)
Hashable)

-- instance At (SnowflakeMap a) where
--   at k f m = at (unSnowflakeMap k) f m

instance Functor SnowflakeMap where
  fmap :: (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 (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 :: (a -> b -> b) -> b -> SnowflakeMap a -> b
foldr a -> b -> b
f b
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 :: (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 (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)
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

-- deriving instance NFData a => NFData (SnowflakeMap a)

-- deriving instance Hashable a => Hashable (SnowflakeMap a)

instance Wrapped (SnowflakeMap a) where
  type Unwrapped (SnowflakeMap a) = HashMap (Snowflake a) a

  _Wrapped' :: p (Unwrapped (SnowflakeMap a)) (f (Unwrapped (SnowflakeMap a)))
-> p (SnowflakeMap a) (f (SnowflakeMap a))
_Wrapped' = (SnowflakeMap a -> HashMap (Snowflake a) a)
-> (HashMap (Snowflake a) a -> SnowflakeMap a)
-> Iso
     (SnowflakeMap a)
     (SnowflakeMap a)
     (HashMap (Snowflake a) a)
     (HashMap (Snowflake a) a)
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 a) a -> SnowflakeMap a
forall a. HashMap (Snowflake a) a -> SnowflakeMap a
SnowflakeMap

type instance Index (SnowflakeMap a) = Snowflake a

type instance IxValue (SnowflakeMap a) = a

instance SnowflakeMap a ~ t => Rewrapped (SnowflakeMap b) a

instance Ixed (SnowflakeMap a) where
  ix :: Index (SnowflakeMap a)
-> Traversal' (SnowflakeMap a) (IxValue (SnowflakeMap a))
ix Index (SnowflakeMap a)
i = (HashMap (Snowflake a) a -> f (HashMap (Snowflake a) a))
-> SnowflakeMap a -> f (SnowflakeMap a)
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped ((HashMap (Snowflake a) a -> f (HashMap (Snowflake a) a))
 -> SnowflakeMap a -> f (SnowflakeMap a))
-> ((a -> f a)
    -> HashMap (Snowflake a) a -> f (HashMap (Snowflake a) a))
-> (a -> f a)
-> SnowflakeMap a
-> f (SnowflakeMap a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (HashMap (Snowflake a) a)
-> Traversal'
     (HashMap (Snowflake a) a) (IxValue (HashMap (Snowflake a) a))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (HashMap (Snowflake a) a)
Index (SnowflakeMap a)
i

instance At (SnowflakeMap a) where
  at :: Index (SnowflakeMap a)
-> Lens' (SnowflakeMap a) (Maybe (IxValue (SnowflakeMap a)))
at Index (SnowflakeMap a)
i = (HashMap (Snowflake a) a -> f (HashMap (Snowflake a) a))
-> SnowflakeMap a -> f (SnowflakeMap a)
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped ((HashMap (Snowflake a) a -> f (HashMap (Snowflake a) a))
 -> SnowflakeMap a -> f (SnowflakeMap a))
-> ((Maybe a -> f (Maybe a))
    -> HashMap (Snowflake a) a -> f (HashMap (Snowflake a) a))
-> (Maybe a -> f (Maybe a))
-> SnowflakeMap a
-> f (SnowflakeMap a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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

over :: (HashMap (Snowflake a) a -> HashMap (Snowflake b) b) -> SnowflakeMap a -> SnowflakeMap b
over :: (HashMap (Snowflake a) a -> HashMap (Snowflake b) b)
-> SnowflakeMap a -> SnowflakeMap b
over 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 over #-}

-- SAFETY: 'Snowflake' always uses the underlying hash function (Word64)
coerceSnowflakeMap :: HashMap (Snowflake a) v -> HashMap (Snowflake b) v
coerceSnowflakeMap :: 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 :: 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 :: 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 :: 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 :: 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 :: 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 :: 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 :: 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
(!) 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 :: 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
over ((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 :: (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
over ((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 :: 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
over ((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 :: (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
over ((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 :: (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
over ((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 :: (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
over ((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 :: 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 :: (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 :: (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 :: [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 :: (a1 -> a2) -> SnowflakeMap a1 -> SnowflakeMap a2
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
over ((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 :: (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
over ((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 :: (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 (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 :: 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 :: (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 :: 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 :: (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 :: (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' :: (a -> b -> a) -> a -> SnowflakeMap b -> a
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' :: (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 :: (b -> a -> a) -> a -> SnowflakeMap b -> a
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 :: (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 :: (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
over ((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 :: (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
over ((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 :: (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
over ((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 :: (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
over ((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 :: 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 :: 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 :: 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 :: [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 :: (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)
traverse Value -> Parser a
forall a. FromJSON a => Value -> Parser a
parseJSON Array
l
    SnowflakeMap a -> Parser (SnowflakeMap 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 (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