graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Data.HashMap.Strict.NonEmpty

Description

Non-empty hash maps.

Synopsis

Documentation

newtype NEHashMap k v Source #

A non-empty hashmap is a wrapper around a normal hashmap, that only provides a restricted set of functionalities. It doesn't provide a Monoid instance, nor an empty function.

Constructors

NEHashMap 

Fields

Instances

Instances details
Functor (NEHashMap k) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

fmap :: (a -> b) -> NEHashMap k a -> NEHashMap k b #

(<$) :: a -> NEHashMap k b -> NEHashMap k a #

Foldable (NEHashMap k) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

fold :: Monoid m => NEHashMap k m -> m #

foldMap :: Monoid m => (a -> m) -> NEHashMap k a -> m #

foldMap' :: Monoid m => (a -> m) -> NEHashMap k a -> m #

foldr :: (a -> b -> b) -> b -> NEHashMap k a -> b #

foldr' :: (a -> b -> b) -> b -> NEHashMap k a -> b #

foldl :: (b -> a -> b) -> b -> NEHashMap k a -> b #

foldl' :: (b -> a -> b) -> b -> NEHashMap k a -> b #

foldr1 :: (a -> a -> a) -> NEHashMap k a -> a #

foldl1 :: (a -> a -> a) -> NEHashMap k a -> a #

toList :: NEHashMap k a -> [a] #

null :: NEHashMap k a -> Bool #

length :: NEHashMap k a -> Int #

elem :: Eq a => a -> NEHashMap k a -> Bool #

maximum :: Ord a => NEHashMap k a -> a #

minimum :: Ord a => NEHashMap k a -> a #

sum :: Num a => NEHashMap k a -> a #

product :: Num a => NEHashMap k a -> a #

Traversable (NEHashMap k) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

traverse :: Applicative f => (a -> f b) -> NEHashMap k a -> f (NEHashMap k b) #

sequenceA :: Applicative f => NEHashMap k (f a) -> f (NEHashMap k a) #

mapM :: Monad m => (a -> m b) -> NEHashMap k a -> m (NEHashMap k b) #

sequence :: Monad m => NEHashMap k (m a) -> m (NEHashMap k a) #

(Eq k, Eq v) => Eq (NEHashMap k v) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

(==) :: NEHashMap k v -> NEHashMap k v -> Bool #

(/=) :: NEHashMap k v -> NEHashMap k v -> Bool #

(Ord k, Ord v) => Ord (NEHashMap k v) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

compare :: NEHashMap k v -> NEHashMap k v -> Ordering #

(<) :: NEHashMap k v -> NEHashMap k v -> Bool #

(<=) :: NEHashMap k v -> NEHashMap k v -> Bool #

(>) :: NEHashMap k v -> NEHashMap k v -> Bool #

(>=) :: NEHashMap k v -> NEHashMap k v -> Bool #

max :: NEHashMap k v -> NEHashMap k v -> NEHashMap k v #

min :: NEHashMap k v -> NEHashMap k v -> NEHashMap k v #

(Show k, Show v) => Show (NEHashMap k v) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

showsPrec :: Int -> NEHashMap k v -> ShowS #

show :: NEHashMap k v -> String #

showList :: [NEHashMap k v] -> ShowS #

(Eq k, Hashable k) => Semigroup (NEHashMap k v) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

(<>) :: NEHashMap k v -> NEHashMap k v -> NEHashMap k v #

sconcat :: NonEmpty (NEHashMap k v) -> NEHashMap k v #

stimes :: Integral b => b -> NEHashMap k v -> NEHashMap k v #

(NFData k, NFData v) => NFData (NEHashMap k v) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

rnf :: NEHashMap k v -> () #

(Hashable k, Hashable v) => Hashable (NEHashMap k v) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

hashWithSalt :: Int -> NEHashMap k v -> Int

hash :: NEHashMap k v -> Int

(FromJSON v, FromJSONKey k, Eq k, Hashable k) => FromJSON (NEHashMap k v) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

parseJSON :: Value -> Parser (NEHashMap k v)

parseJSONList :: Value -> Parser [NEHashMap k v]

(ToJSON v, ToJSONKey k) => ToJSON (NEHashMap k v) Source # 
Instance details

Defined in Data.HashMap.Strict.NonEmpty

Methods

toJSON :: NEHashMap k v -> Value

toEncoding :: NEHashMap k v -> Encoding

toJSONList :: [NEHashMap k v] -> Value

toEncodingList :: [NEHashMap k v] -> Encoding

(Cacheable k, Cacheable v) => Cacheable (NEHashMap k v) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Dependency

Methods

unchanged :: Accesses -> NEHashMap k v -> NEHashMap k v -> Bool Source #

singleton :: Hashable k => k -> v -> NEHashMap k v Source #

Construct a non-empty map with a single element.

fromHashMap :: HashMap k v -> Maybe (NEHashMap k v) Source #

Construct a non-empty map with the supplied mappings. Returns Nothing if the provided HashMap is empty.

fromList :: (Eq k, Hashable k) => [(k, v)] -> Maybe (NEHashMap k v) Source #

Construct a non-empty map with the supplied mappings as follows:

  • if the provided list contains duplicate mappings, the later mappings take precedence;
  • if the provided list is empty, returns Nothing.

fromNonEmpty :: (Eq k, Hashable k) => NonEmpty (k, v) -> NEHashMap k v Source #

A variant of fromList that uses NonEmpty inputs.

toHashMap :: NEHashMap k v -> HashMap k v Source #

Convert a non-empty map to a HashMap.

toNonEmpty :: NEHashMap k v -> NonEmpty (k, v) Source #

Convert a non-empty map to a non-empty list of key/value pairs. The closed operations of NEHashMap guarantee that this operation won't fail.

toList :: NEHashMap k v -> [(k, v)] Source #

Convert a non-empty map to a list of key/value pairs.

lookup :: (Eq k, Hashable k) => k -> NEHashMap k v -> Maybe v Source #

Return the value to which the specified key is mapped, or Nothing if this map contains no mapping for the key.

(!?) :: (Eq k, Hashable k) => NEHashMap k v -> k -> Maybe v Source #

Return the value to which the specified key is mapped, or Nothing if this map contains no mapping for the key.

This is a flipped version of lookup.

keys :: NEHashMap k v -> [k] Source #

Return a list of this map's keys.

union :: (Eq k, Hashable k) => NEHashMap k v -> NEHashMap k v -> NEHashMap k v Source #

The union of two maps.

If a key occurs in both maps, the left map m1 (first argument) will be preferred.

unionWith :: (Eq k, Hashable k) => (v -> v -> v) -> NEHashMap k v -> NEHashMap k v -> NEHashMap k v Source #

The union of two maps using a given value-wise union function.

If a key occurs in both maps, the provided function (first argument) will be used to compute the result.

mapKeys :: (Eq k2, Hashable k2) => (k1 -> k2) -> NEHashMap k1 v -> NEHashMap k2 v Source #

mapKeys f s is the map obtained by applying f to each key of s.

The size of the result may be smaller if f maps two or more distinct keys to the same new key. In this case there is no guarantee which of the associated values is chosen for the conflicting key.

isInverseOf :: (Eq k, Hashable k, Eq v, Hashable v) => NEHashMap k v -> NEHashMap v k -> Bool Source #

Determines whether the left-hand-side and the right-hand-side are inverses of each other.

More specifically, for two maps A and B, isInverseOf is satisfied when both of the following are true: 1. ∀ key ∈ A. A[key] ∈ B ∧ B[A[key]] == key 2. ∀ key ∈ B. B[key] ∈ A ∧ A[B[key]] == key