insert-ordered-containers-0.2.5.1: Associative containers retaining insertion order for traversals.
Safe Haskell Trustworthy
Language Haskell2010

Data.HashMap.Strict.InsOrd

Description

InsOrdHashMap is like HashMap , but it folds and traverses in insertion order.

This module interface mimics Data.HashMap.Strict , with some additions.

Synopsis

Documentation

data InsOrdHashMap k v Source #

HashMap which tries its best to remember insertion order of elements.

Instances

Instances details
NFData2 InsOrdHashMap Source #

Since: 0.2.5

Instance details

Defined in Data.HashMap.Strict.InsOrd

Methods

liftRnf2 :: (a -> ()) -> (b -> ()) -> InsOrdHashMap a b -> () Source #

( Eq k, Hashable k) => FunctorWithIndex k ( InsOrdHashMap k) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

Methods

imap :: (k -> a -> b) -> InsOrdHashMap k a -> InsOrdHashMap k b Source #

( Eq k, Hashable k) => FoldableWithIndex k ( InsOrdHashMap k) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

Methods

ifoldMap :: Monoid m => (k -> a -> m) -> InsOrdHashMap k a -> m Source #

ifoldMap' :: Monoid m => (k -> a -> m) -> InsOrdHashMap k a -> m Source #

ifoldr :: (k -> a -> b -> b) -> b -> InsOrdHashMap k a -> b Source #

ifoldl :: (k -> b -> a -> b) -> b -> InsOrdHashMap k a -> b Source #

ifoldr' :: (k -> a -> b -> b) -> b -> InsOrdHashMap k a -> b Source #

ifoldl' :: (k -> b -> a -> b) -> b -> InsOrdHashMap k a -> b Source #

( Eq k, Hashable k) => TraversableWithIndex k ( InsOrdHashMap k) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

Methods

itraverse :: Applicative f => (k -> a -> f b) -> InsOrdHashMap k a -> f ( InsOrdHashMap k b) Source #

Functor ( InsOrdHashMap k) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

Foldable ( InsOrdHashMap k) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

Traversable ( InsOrdHashMap k) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

ToJSONKey k => ToJSON1 ( InsOrdHashMap k) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

( Eq k, Hashable k, FromJSONKey k) => FromJSON1 ( InsOrdHashMap k) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

NFData k => NFData1 ( InsOrdHashMap k) Source #

Since: 0.2.5

Instance details

Defined in Data.HashMap.Strict.InsOrd

Methods

liftRnf :: (a -> ()) -> InsOrdHashMap k a -> () Source #

( Eq k, Hashable k) => Apply ( InsOrdHashMap k) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

( Eq k, Hashable k) => Bind ( InsOrdHashMap k) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

( Eq k, Hashable k) => IsList ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

Associated Types

type Item ( InsOrdHashMap k v) Source #

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

Defined in Data.HashMap.Strict.InsOrd

( Data k, Data v, Eq k, Hashable k) => Data ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

Methods

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

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

toConstr :: InsOrdHashMap k v -> Constr Source #

dataTypeOf :: InsOrdHashMap k v -> DataType Source #

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

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

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

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

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

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

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

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

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

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

( Eq k, Hashable k, Read k, Read v) => Read ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

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

Defined in Data.HashMap.Strict.InsOrd

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

Defined in Data.HashMap.Strict.InsOrd

( Eq k, Hashable k) => Monoid ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

( Hashable k, Hashable v) => Hashable ( InsOrdHashMap k v) Source #

hashWithSalt salt . toHashMap = hashWithSalt salt .

Instance details

Defined in Data.HashMap.Strict.InsOrd

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

Defined in Data.HashMap.Strict.InsOrd

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

Defined in Data.HashMap.Strict.InsOrd

( NFData k, NFData v) => NFData ( InsOrdHashMap k v) Source #

Since: 0.2.5

Instance details

Defined in Data.HashMap.Strict.InsOrd

( Eq k, Hashable k) => Ixed ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

( Eq k, Hashable k) => At ( InsOrdHashMap k a) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

( Eq k, Hashable k) => Ixed ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

Associated Types

type IxKind ( InsOrdHashMap k v) Source #

( Eq k, Hashable k) => At ( InsOrdHashMap k a) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

type Item ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

type Item ( InsOrdHashMap k v) = (k, v)
type Index ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

type Index ( InsOrdHashMap k v) = k
type IxValue ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

type Index ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

type Index ( InsOrdHashMap k v) = k
type IxValue ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

type IxKind ( InsOrdHashMap k v) Source #
Instance details

Defined in Data.HashMap.Strict.InsOrd

Construction

Basic interface

lookupDefault Source #

Arguments

:: ( Eq k, Hashable k)
=> v

Default value to return.

-> k
-> InsOrdHashMap k v
-> v

insertWith :: ( Eq k, Hashable k) => (v -> v -> v) -> k -> v -> InsOrdHashMap k v -> InsOrdHashMap k v Source #

Combine

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

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

Ordered traversal will go thru keys in the first map first.

Transformations

mapKeys :: ( Eq k', Hashable k') => (k -> k') -> InsOrdHashMap k v -> InsOrdHashMap k' v Source #

Order preserving mapping of keys.

Unordered

unorderedTraverse :: Applicative f => (a -> f b) -> InsOrdHashMap k a -> f ( InsOrdHashMap k b) Source #

More efficient than traverse , when traversing in insertion order is not important.

unorderedTraverseWithKey :: Applicative f => (k -> a -> f b) -> InsOrdHashMap k a -> f ( InsOrdHashMap k b) Source #

More efficient than traverseWithKey , when traversing in insertion order is not important.

Difference and intersection

Folds

foldl' :: (a -> v -> a) -> a -> InsOrdHashMap k v -> a Source #

foldlWithKey' :: (a -> k -> v -> a) -> a -> InsOrdHashMap k v -> a Source #

foldr :: (v -> a -> a) -> a -> InsOrdHashMap k v -> a Source #

foldrWithKey :: (k -> v -> a -> a) -> a -> InsOrdHashMap k v -> a Source #

Unordered

unorderedFoldMap :: Monoid m => (a -> m) -> InsOrdHashMap k a -> m Source #

More efficient than foldMap , when folding in insertion order is not important.

unorderedFoldMapWithKey :: Monoid m => (k -> a -> m) -> InsOrdHashMap k a -> m Source #

More efficient than foldMapWithKey , when folding in insertion order is not important.

Filter

Conversions

fromList :: forall k v. ( Eq k, Hashable k) => [(k, v)] -> InsOrdHashMap k v Source #

Lenses

hashMap :: Iso ( InsOrdHashMap k a) ( InsOrdHashMap k b) ( HashMap k a) ( HashMap k b) Source #

This is a slight lie, as roundtrip doesn't preserve ordering.

Debugging

valid :: InsOrdHashMap k v -> Bool Source #

Test if the internal map structure is valid.