aeson-2.0.2.0: Fast JSON parsing and encoding
Safe Haskell None
Language Haskell2010

Data.Aeson.KeyMap

Description

An abstract interface for maps from JSON keys to values.

Synopsis

Map Type

data KeyMap v Source #

A map from JSON key type Key to v .

Instances

Instances details
Functor KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Foldable KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Traversable KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Semialign KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Align KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Zip KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Filterable KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Witherable KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

FromJSON1 KeyMap Source #

Since: 2.0.1.0

Instance details

Defined in Data.Aeson.Types.FromJSON

ToJSON1 KeyMap Source #
Instance details

Defined in Data.Aeson.Types.ToJSON

KeyValue Object Source #

Constructs a singleton KeyMap . For calling functions that demand an Object for constructing objects. To be used in conjunction with mconcat . Prefer to use object where possible.

Instance details

Defined in Data.Aeson.Types.ToJSON

FunctorWithIndex Key KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Methods

imap :: ( Key -> a -> b) -> KeyMap a -> KeyMap b Source #

FoldableWithIndex Key KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Methods

ifoldMap :: Monoid m => ( Key -> a -> m) -> KeyMap a -> m Source #

ifoldMap' :: Monoid m => ( Key -> a -> m) -> KeyMap a -> m Source #

ifoldr :: ( Key -> a -> b -> b) -> b -> KeyMap a -> b Source #

ifoldl :: ( Key -> b -> a -> b) -> b -> KeyMap a -> b Source #

ifoldr' :: ( Key -> a -> b -> b) -> b -> KeyMap a -> b Source #

ifoldl' :: ( Key -> b -> a -> b) -> b -> KeyMap a -> b Source #

TraversableWithIndex Key KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Methods

itraverse :: Applicative f => ( Key -> a -> f b) -> KeyMap a -> f ( KeyMap b) Source #

SemialignWithIndex Key KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

ZipWithIndex Key KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Methods

izipWith :: ( Key -> a -> b -> c) -> KeyMap a -> KeyMap b -> KeyMap c Source #

FilterableWithIndex Key KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

WitherableWithIndex Key KeyMap Source #
Instance details

Defined in Data.Aeson.KeyMap

Lift v => Lift ( KeyMap v :: Type ) Source #
Instance details

Defined in Data.Aeson.KeyMap

IsList ( KeyMap v) Source #

Since: 2.0.2.0

Instance details

Defined in Data.Aeson.KeyMap

Associated Types

type Item ( KeyMap v) Source #

Eq v => Eq ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.KeyMap

Data v => Data ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.KeyMap

Methods

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

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

toConstr :: KeyMap v -> Constr Source #

dataTypeOf :: KeyMap v -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Ord v => Ord ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.KeyMap

Read v => Read ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.KeyMap

Show v => Show ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.KeyMap

Semigroup ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.KeyMap

Monoid ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.KeyMap

NFData v => NFData ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.KeyMap

Methods

rnf :: KeyMap v -> () Source #

Hashable v => Hashable ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.KeyMap

FromJSON v => FromJSON ( KeyMap v) Source #

Since: 2.0.1.0

Instance details

Defined in Data.Aeson.Types.FromJSON

ToJSON v => ToJSON ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.Types.ToJSON

type Item ( KeyMap v) Source #
Instance details

Defined in Data.Aeson.KeyMap

type Item ( KeyMap v) = ( Key , v)

Query

null :: KeyMap v -> Bool Source #

Is the map empty?

lookup :: Key -> KeyMap 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.

size :: KeyMap v -> Int Source #

Return the number of key-value mappings in this map.

member :: Key -> KeyMap a -> Bool Source #

Is the key a member of the map?

Construction

empty :: KeyMap v Source #

Construct an empty map.

singleton :: Key -> v -> KeyMap v Source #

Construct a map with a single element.

Insertion

insert :: Key -> v -> KeyMap v -> KeyMap v Source #

Associate the specified value with the specified key in this map. If this map previously contained a mapping for the key, the old value is replaced.

Deletion

delete :: Key -> KeyMap v -> KeyMap v Source #

Remove the mapping for the specified key from this map if present.

Update

alterF :: Functor f => ( Maybe v -> f ( Maybe v)) -> Key -> KeyMap v -> f ( KeyMap v) Source #

alterF can be used to insert, delete, or update a value in a map.

Combine

difference :: KeyMap v -> KeyMap v' -> KeyMap v Source #

Difference of two maps. Return elements of the first map not existing in the second.

unionWith :: (v -> v -> v) -> KeyMap v -> KeyMap v -> KeyMap v Source #

The union with a combining function.

unionWithKey :: ( Key -> v -> v -> v) -> KeyMap v -> KeyMap v -> KeyMap v Source #

The union with a combining function.

intersection :: KeyMap a -> KeyMap b -> KeyMap a Source #

The (left-biased) intersection of two maps (based on keys).

intersectionWith :: (a -> b -> c) -> KeyMap a -> KeyMap b -> KeyMap c Source #

The intersection with a combining function.

intersectionWithKey :: ( Key -> a -> b -> c) -> KeyMap a -> KeyMap b -> KeyMap c Source #

The intersection with a combining function.

alignWith :: ( These a b -> c) -> KeyMap a -> KeyMap b -> KeyMap c Source #

Generalized union with combining function.

alignWithKey :: ( Key -> These a b -> c) -> KeyMap a -> KeyMap b -> KeyMap c Source #

Generalized union with combining function.

Lists

fromList :: [( Key , v)] -> KeyMap v Source #

Construct a map with the supplied mappings. If the list contains duplicate mappings, the later mappings take precedence.

fromListWith :: (v -> v -> v) -> [( Key , v)] -> KeyMap v Source #

Construct a map from a list of elements. Uses the provided function, f, to merge duplicate entries with (f newVal oldVal).

toList :: KeyMap v -> [( Key , v)] Source #

Return a list of this map's elements.

The order is not stable. Use toAscList for stable ordering.

toAscList :: KeyMap v -> [( Key , v)] Source #

Return a list of this map's elements in ascending order based of the textual key.

Maps

Traversal

Map

map :: (a -> b) -> KeyMap a -> KeyMap b Source #

Map a function over all values in the map.

mapKeyVal :: ( Key -> Key ) -> (v1 -> v2) -> KeyMap v1 -> KeyMap v2 Source #

Transform the keys and values of a KeyMap .

traverse :: Applicative f => (v1 -> f v2) -> KeyMap v1 -> f ( KeyMap v2) Source #

Perform an Applicative action for each key-value pair in a KeyMap and produce a KeyMap of all the results.

traverseWithKey :: Applicative f => ( Key -> v1 -> f v2) -> KeyMap v1 -> f ( KeyMap v2) Source #

Perform an Applicative action for each key-value pair in a KeyMap and produce a KeyMap of all the results.

Folds

foldr :: (a -> b -> b) -> b -> KeyMap a -> b Source #

foldr' :: (a -> b -> b) -> b -> KeyMap a -> b Source #

foldl :: (b -> a -> b) -> b -> KeyMap a -> b Source #

foldl' :: (b -> a -> b) -> b -> KeyMap a -> b Source #

foldrWithKey :: ( Key -> v -> a -> a) -> a -> KeyMap v -> a Source #

Reduce this map by applying a binary operator to all elements, using the given starting value (typically the right-identity of the operator).

Conversions

keys :: KeyMap v -> [ Key ] Source #

Return a list of this map's keys.

Filter

filter :: (v -> Bool ) -> KeyMap v -> KeyMap v Source #

Filter all keys/values that satisfy some predicate.

filterWithKey :: ( Key -> v -> Bool ) -> KeyMap v -> KeyMap v Source #

Filter all keys/values that satisfy some predicate.

mapMaybe :: (a -> Maybe b) -> KeyMap a -> KeyMap b Source #

Map values and collect the Just results.

mapMaybeWithKey :: ( Key -> v -> Maybe u) -> KeyMap v -> KeyMap u Source #

Map values and collect the Just results.