sdp4unordered-0.2: SDP classes for unordered containers
Copyright(c) Andrey Mulik 2020
LicenseBSD-style
Maintainerwork.a.mulik@gmail.com
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

SDP.HashMap.Lazy

Description

SDP.HashMap.Lazy provides HashMap - lazy unordered associative array with Hashable keys.

Synopsis

Exports

module SDP.Linear

module SDP.Map

Hash map

data HashMap k v #

A map from keys to values. A map cannot contain duplicate keys; each key can map to at most one value.

Instances

Instances details
Bifoldable HashMap

Since: unordered-containers-0.2.11

Instance details

Defined in Data.HashMap.Internal

Methods

bifold :: Monoid m => HashMap m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> HashMap a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> HashMap a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> HashMap a b -> c #

Eq2 HashMap 
Instance details

Defined in Data.HashMap.Internal

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> HashMap a c -> HashMap b d -> Bool #

Ord2 HashMap 
Instance details

Defined in Data.HashMap.Internal

Methods

liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> HashMap a c -> HashMap b d -> Ordering #

Show2 HashMap 
Instance details

Defined in Data.HashMap.Internal

Methods

liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> HashMap a b -> ShowS #

liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [HashMap a b] -> ShowS #

Hashable2 HashMap 
Instance details

Defined in Data.HashMap.Internal

Methods

liftHashWithSalt2 :: (Int -> a -> Int) -> (Int -> b -> Int) -> Int -> HashMap a b -> Int #

Functor (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

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

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

Foldable (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

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

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

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

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

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

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

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

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

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

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

null :: HashMap k a -> Bool #

length :: HashMap k a -> Int #

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

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

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

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

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

Traversable (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

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

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

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

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

Eq k => Eq1 (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

liftEq :: (a -> b -> Bool) -> HashMap k a -> HashMap k b -> Bool #

Ord k => Ord1 (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

liftCompare :: (a -> b -> Ordering) -> HashMap k a -> HashMap k b -> Ordering #

(Eq k, Hashable k, Read k) => Read1 (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (HashMap k a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [HashMap k a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (HashMap k a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [HashMap k a] #

Show k => Show1 (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> HashMap k a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [HashMap k a] -> ShowS #

Hashable k => Hashable1 (HashMap k) 
Instance details

Defined in Data.HashMap.Internal

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> HashMap k a -> Int #

(Eq k, Hashable k) => IsList (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Associated Types

type Item (HashMap k v) #

Methods

fromList :: [Item (HashMap k v)] -> HashMap k v #

fromListN :: Int -> [Item (HashMap k v)] -> HashMap k v #

toList :: HashMap k v -> [Item (HashMap k v)] #

(Eq k, Eq v) => Eq (HashMap k v)

Note that, in the presence of hash collisions, equal HashMaps may behave differently, i.e. substitutivity may be violated:

>>> data D = A | B deriving (Eq, Show)
>>> instance Hashable D where hashWithSalt salt _d = salt
>>> x = fromList [(A,1), (B,2)]
>>> y = fromList [(B,2), (A,1)]
>>> x == y
True
>>> toList x
[(A,1),(B,2)]
>>> toList y
[(B,2),(A,1)]

In general, the lack of substitutivity can be observed with any function that depends on the key ordering, such as folds and traversals.

Instance details

Defined in Data.HashMap.Internal

Methods

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

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

(Data k, Data v, Eq k, Hashable k) => Data (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HashMap k v -> c (HashMap k v) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HashMap k v) #

toConstr :: HashMap k v -> Constr #

dataTypeOf :: HashMap k v -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HashMap k v)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HashMap k v)) #

gmapT :: (forall b. Data b => b -> b) -> HashMap k v -> HashMap k v #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HashMap k v -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HashMap k v -> r #

gmapQ :: (forall d. Data d => d -> u) -> HashMap k v -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HashMap k v -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) #

(Ord k, Ord v) => Ord (HashMap k v)

The ordering is total and consistent with the Eq instance. However, nothing else about the ordering is specified, and it may change from version to version of either this package or of hashable.

Instance details

Defined in Data.HashMap.Internal

Methods

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

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

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

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

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

max :: HashMap k v -> HashMap k v -> HashMap k v #

min :: HashMap k v -> HashMap k v -> HashMap k v #

(Eq k, Hashable k, Read k, Read e) => Read (HashMap k e) 
Instance details

Defined in Data.HashMap.Internal

(Show k, Show v) => Show (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Methods

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

show :: HashMap k v -> String #

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

(Eq k, Hashable k) => Semigroup (HashMap k v)

<> = union

If a key occurs in both maps, the mapping from the first will be the mapping in the result.

Examples

Expand
>>> fromList [(1,'a'),(2,'b')] <> fromList [(2,'c'),(3,'d')]
fromList [(1,'a'),(2,'b'),(3,'d')]
Instance details

Defined in Data.HashMap.Internal

Methods

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

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

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

(Eq k, Hashable k) => Monoid (HashMap k v)

mempty = empty

mappend = union

If a key occurs in both maps, the mapping from the first will be the mapping in the result.

Examples

Expand
>>> mappend (fromList [(1,'a'),(2,'b')]) (fromList [(2,'c'),(3,'d')])
fromList [(1,'a'),(2,'b'),(3,'d')]
Instance details

Defined in Data.HashMap.Internal

Methods

mempty :: HashMap k v #

mappend :: HashMap k v -> HashMap k v -> HashMap k v #

mconcat :: [HashMap k v] -> HashMap k v #

(NFData k, NFData v) => NFData (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Methods

rnf :: HashMap k v -> () #

(Hashable k, Hashable v) => Hashable (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

Methods

hashWithSalt :: Int -> HashMap k v -> Int #

hash :: HashMap k v -> Int #

Nullable (HashMap k e) Source # 
Instance details

Defined in SDP.HashMap.Lazy

Methods

lzero :: HashMap k e #

isNull :: HashMap k e -> Bool #

Nullable (HashMap k e) Source # 
Instance details

Defined in SDP.HashMap.Strict

Methods

lzero :: HashMap k e #

isNull :: HashMap k e -> Bool #

Index k => Estimate (HashMap k e) Source # 
Instance details

Defined in SDP.HashMap.Lazy

Methods

(<.=>) :: HashMap k e -> Int -> Ordering #

(<==>) :: Compare (HashMap k e) #

(.==) :: HashMap k e -> Int -> Bool #

(./=) :: HashMap k e -> Int -> Bool #

(.<=) :: HashMap k e -> Int -> Bool #

(.>=) :: HashMap k e -> Int -> Bool #

(.<) :: HashMap k e -> Int -> Bool #

(.>) :: HashMap k e -> Int -> Bool #

(.<.) :: HashMap k e -> HashMap k e -> Bool #

(.>.) :: HashMap k e -> HashMap k e -> Bool #

(.<=.) :: HashMap k e -> HashMap k e -> Bool #

(.>=.) :: HashMap k e -> HashMap k e -> Bool #

(.==.) :: HashMap k e -> HashMap k e -> Bool #

(./=.) :: HashMap k e -> HashMap k e -> Bool #

Index k => Estimate (HashMap k e) Source # 
Instance details

Defined in SDP.HashMap.Strict

Methods

(<.=>) :: HashMap k e -> Int -> Ordering #

(<==>) :: Compare (HashMap k e) #

(.==) :: HashMap k e -> Int -> Bool #

(./=) :: HashMap k e -> Int -> Bool #

(.<=) :: HashMap k e -> Int -> Bool #

(.>=) :: HashMap k e -> Int -> Bool #

(.<) :: HashMap k e -> Int -> Bool #

(.>) :: HashMap k e -> Int -> Bool #

(.<.) :: HashMap k e -> HashMap k e -> Bool #

(.>.) :: HashMap k e -> HashMap k e -> Bool #

(.<=.) :: HashMap k e -> HashMap k e -> Bool #

(.>=.) :: HashMap k e -> HashMap k e -> Bool #

(.==.) :: HashMap k e -> HashMap k e -> Bool #

(./=.) :: HashMap k e -> HashMap k e -> Bool #

(Eq k, Hashable k) => Map (HashMap k e) k e Source # 
Instance details

Defined in SDP.HashMap.Lazy

Methods

assocs :: HashMap k e -> [(k, e)] #

toMap :: [(k, e)] -> HashMap k e #

toMap' :: e -> [(k, e)] -> HashMap k e #

insert' :: k -> e -> HashMap k e -> HashMap k e #

delete' :: k -> HashMap k e -> HashMap k e #

member' :: k -> HashMap k e -> Bool #

(//) :: HashMap k e -> [(k, e)] -> HashMap k e #

(.!) :: HashMap k e -> k -> e #

(!) :: HashMap k e -> k -> e #

(!?) :: HashMap k e -> k -> Maybe e #

filter' :: (k -> e -> Bool) -> HashMap k e -> HashMap k e #

union' :: (e -> e -> e) -> HashMap k e -> HashMap k e -> HashMap k e #

difference' :: (e -> e -> Maybe e) -> HashMap k e -> HashMap k e -> HashMap k e #

intersection' :: (e -> e -> e) -> HashMap k e -> HashMap k e -> HashMap k e #

update :: HashMap k e -> (k -> e -> e) -> HashMap k e #

lookupLT' :: k -> HashMap k e -> Maybe (k, e) #

lookupGT' :: k -> HashMap k e -> Maybe (k, e) #

lookupLE' :: k -> HashMap k e -> Maybe (k, e) #

lookupGE' :: k -> HashMap k e -> Maybe (k, e) #

keys :: HashMap k e -> [k] #

(.$) :: (e -> Bool) -> HashMap k e -> Maybe k #

(*$) :: (e -> Bool) -> HashMap k e -> [k] #

kfoldr :: (k -> e -> b -> b) -> b -> HashMap k e -> b #

kfoldl :: (k -> b -> e -> b) -> b -> HashMap k e -> b #

kfoldr' :: (k -> e -> b -> b) -> b -> HashMap k e -> b #

kfoldl' :: (k -> b -> e -> b) -> b -> HashMap k e -> b #

(Eq k, Hashable k) => Map (HashMap k e) k e Source # 
Instance details

Defined in SDP.HashMap.Strict

Methods

assocs :: HashMap k e -> [(k, e)] #

toMap :: [(k, e)] -> HashMap k e #

toMap' :: e -> [(k, e)] -> HashMap k e #

insert' :: k -> e -> HashMap k e -> HashMap k e #

delete' :: k -> HashMap k e -> HashMap k e #

member' :: k -> HashMap k e -> Bool #

(//) :: HashMap k e -> [(k, e)] -> HashMap k e #

(.!) :: HashMap k e -> k -> e #

(!) :: HashMap k e -> k -> e #

(!?) :: HashMap k e -> k -> Maybe e #

filter' :: (k -> e -> Bool) -> HashMap k e -> HashMap k e #

union' :: (e -> e -> e) -> HashMap k e -> HashMap k e -> HashMap k e #

difference' :: (e -> e -> Maybe e) -> HashMap k e -> HashMap k e -> HashMap k e #

intersection' :: (e -> e -> e) -> HashMap k e -> HashMap k e -> HashMap k e #

update :: HashMap k e -> (k -> e -> e) -> HashMap k e #

lookupLT' :: k -> HashMap k e -> Maybe (k, e) #

lookupGT' :: k -> HashMap k e -> Maybe (k, e) #

lookupLE' :: k -> HashMap k e -> Maybe (k, e) #

lookupGE' :: k -> HashMap k e -> Maybe (k, e) #

keys :: HashMap k e -> [k] #

(.$) :: (e -> Bool) -> HashMap k e -> Maybe k #

(*$) :: (e -> Bool) -> HashMap k e -> [k] #

kfoldr :: (k -> e -> b -> b) -> b -> HashMap k e -> b #

kfoldl :: (k -> b -> e -> b) -> b -> HashMap k e -> b #

kfoldr' :: (k -> e -> b -> b) -> b -> HashMap k e -> b #

kfoldl' :: (k -> b -> e -> b) -> b -> HashMap k e -> b #

type Item (HashMap k v) 
Instance details

Defined in Data.HashMap.Internal

type Item (HashMap k v) = (k, v)

type LHashMap = HashMap Source #

HashMap alias, may reduce ambiguity.

Orphan instances

Nullable (HashMap k e) Source # 
Instance details

Methods

lzero :: HashMap k e #

isNull :: HashMap k e -> Bool #

Index k => Estimate (HashMap k e) Source # 
Instance details

Methods

(<.=>) :: HashMap k e -> Int -> Ordering #

(<==>) :: Compare (HashMap k e) #

(.==) :: HashMap k e -> Int -> Bool #

(./=) :: HashMap k e -> Int -> Bool #

(.<=) :: HashMap k e -> Int -> Bool #

(.>=) :: HashMap k e -> Int -> Bool #

(.<) :: HashMap k e -> Int -> Bool #

(.>) :: HashMap k e -> Int -> Bool #

(.<.) :: HashMap k e -> HashMap k e -> Bool #

(.>.) :: HashMap k e -> HashMap k e -> Bool #

(.<=.) :: HashMap k e -> HashMap k e -> Bool #

(.>=.) :: HashMap k e -> HashMap k e -> Bool #

(.==.) :: HashMap k e -> HashMap k e -> Bool #

(./=.) :: HashMap k e -> HashMap k e -> Bool #

(Eq k, Hashable k) => Map (HashMap k e) k e Source # 
Instance details

Methods

assocs :: HashMap k e -> [(k, e)] #

toMap :: [(k, e)] -> HashMap k e #

toMap' :: e -> [(k, e)] -> HashMap k e #

insert' :: k -> e -> HashMap k e -> HashMap k e #

delete' :: k -> HashMap k e -> HashMap k e #

member' :: k -> HashMap k e -> Bool #

(//) :: HashMap k e -> [(k, e)] -> HashMap k e #

(.!) :: HashMap k e -> k -> e #

(!) :: HashMap k e -> k -> e #

(!?) :: HashMap k e -> k -> Maybe e #

filter' :: (k -> e -> Bool) -> HashMap k e -> HashMap k e #

union' :: (e -> e -> e) -> HashMap k e -> HashMap k e -> HashMap k e #

difference' :: (e -> e -> Maybe e) -> HashMap k e -> HashMap k e -> HashMap k e #

intersection' :: (e -> e -> e) -> HashMap k e -> HashMap k e -> HashMap k e #

update :: HashMap k e -> (k -> e -> e) -> HashMap k e #

lookupLT' :: k -> HashMap k e -> Maybe (k, e) #

lookupGT' :: k -> HashMap k e -> Maybe (k, e) #

lookupLE' :: k -> HashMap k e -> Maybe (k, e) #

lookupGE' :: k -> HashMap k e -> Maybe (k, e) #

keys :: HashMap k e -> [k] #

(.$) :: (e -> Bool) -> HashMap k e -> Maybe k #

(*$) :: (e -> Bool) -> HashMap k e -> [k] #

kfoldr :: (k -> e -> b -> b) -> b -> HashMap k e -> b #

kfoldl :: (k -> b -> e -> b) -> b -> HashMap k e -> b #

kfoldr' :: (k -> e -> b -> b) -> b -> HashMap k e -> b #

kfoldl' :: (k -> b -> e -> b) -> b -> HashMap k e -> b #