HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleaeson-2.2.5.1Haskell2010

Data.Aeson.KeyMap

An abstract interface for maps from JSON keys to values.

Contents
  1. Map Type
  2. Query
  3. Construction
  4. Insertion
  5. Deletion
  6. Update
  7. Combine
  8. Lists
  9. Maps
  10. Traversal
  11. Map
  12. Folds
  13. Conversions
  14. Filter
  15. Key Type
Synopsis
  • Packageaeson-2.2.5.1
  • Exports53
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceKeyMap.hs

Map Type

newtypenewtype KeyMap v

A map from JSON key type Key to v.

Instances38Functor, Foldable, Traversable, Arbitrary1, Align, Semialign, …

Query

valuelookup :: Key -> KeyMap v -> Maybe v

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

value(!?) :: KeyMap v -> Key -> Maybe v

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.

Construction

Insertion

valueinsert :: Key -> v -> KeyMap v -> KeyMap v

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

Update

Combine

Lists

valuefromList :: [(Key, v)] -> KeyMap v

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

Example1 expression
fromList [("a", 'x'), ("a", 'y')]fromList [("a",'y')]
valuefromListWith :: (v -> v -> v) -> [(Key, v)] -> KeyMap v

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

valuetoAscList :: KeyMap v -> [(Key, v)]

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

Maps

Traversal

Map

Folds

valuefoldrWithKey :: (Key -> v -> a -> a) -> a -> KeyMap v -> a

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

Conversions

Filter

Key Type

newtypenewtype Key
#
Instances27Eq, Data, Ord, Read, Show, IsString, …