{-# OPTIONS_GHC -Wno-redundant-constraints #-}

module Cereal.UnorderedContainers.Get where

import qualified Cereal.UnorderedContainers.Extras.StrictHashMap as StrictHashMap
import Cereal.UnorderedContainers.Prelude

strictHashMap :: (Eq key, Hashable key) => Get Int -> Get key -> Get value -> Get (StrictHashMap.HashMap key value)
strictHashMap :: forall key value.
(Eq key, Hashable key) =>
Get Int -> Get key -> Get value -> Get (HashMap key value)
strictHashMap Get Int
int Get key
key Get value
value = Get Int
size forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> Get (HashMap key value)
associations
  where
    size :: Get Int
size = Get Int
int
    associations :: Int -> Get (HashMap key value)
associations Int
size = forall (m :: * -> *) k v.
(Monad m, Eq k, Hashable k) =>
Int -> m (k, v) -> m (HashMap k v)
StrictHashMap.replicateM Int
size ((,) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get key
key forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Get value
value)