Safe Haskell | None |
---|---|
Language | Haskell98 |
Utilities for dealing with Aeson version update
Synopsis
- fromMapText :: Map Text v -> KeyMap v
- toMapText :: KeyMap v -> Map Text v
- fromHashMapText :: HashMap Text v -> KeyMap v
- toHashMapText :: KeyMap v -> HashMap Text v
- alignWithKey :: (Key -> These a b -> c) -> KeyMap a -> KeyMap b -> KeyMap c
- alignWith :: (These a b -> c) -> KeyMap a -> KeyMap b -> KeyMap c
- mapMaybeWithKey :: (Key -> v -> Maybe u) -> KeyMap v -> KeyMap u
- mapMaybe :: (a -> Maybe b) -> KeyMap a -> KeyMap b
- filterWithKey :: (Key -> v -> Bool) -> KeyMap v -> KeyMap v
- filter :: (v -> Bool) -> KeyMap v -> KeyMap v
- mapKeyVal :: (Key -> Key) -> (v1 -> v2) -> KeyMap v1 -> KeyMap v2
- coercionToMap :: Maybe (Coercion (Map Key v) (KeyMap v))
- coercionToHashMap :: Maybe (Coercion (HashMap Key v) (KeyMap v))
- fromMap :: Map Key v -> KeyMap v
- toMap :: KeyMap v -> Map Key v
- fromHashMap :: HashMap Key v -> KeyMap v
- toHashMap :: KeyMap v -> HashMap Key v
- keys :: KeyMap v -> [Key]
- intersectionWithKey :: (Key -> a -> b -> c) -> KeyMap a -> KeyMap b -> KeyMap c
- intersectionWith :: (a -> b -> c) -> KeyMap a -> KeyMap b -> KeyMap c
- intersection :: KeyMap a -> KeyMap b -> KeyMap a
- unionWithKey :: (Key -> v -> v -> v) -> KeyMap v -> KeyMap v -> KeyMap v
- unionWith :: (v -> v -> v) -> KeyMap v -> KeyMap v -> KeyMap v
- union :: KeyMap v -> KeyMap v -> KeyMap v
- difference :: KeyMap v -> KeyMap v' -> KeyMap v
- toAscList :: KeyMap v -> [(Key, v)]
- elems :: KeyMap v -> [v]
- toList :: KeyMap v -> [(Key, v)]
- fromList :: [(Key, v)] -> KeyMap v
- fromListWith :: (v -> v -> v) -> [(Key, v)] -> KeyMap v
- traverseWithKey :: Applicative f => (Key -> v1 -> f v2) -> KeyMap v1 -> f (KeyMap v2)
- traverse :: Applicative f => (v1 -> f v2) -> KeyMap v1 -> f (KeyMap v2)
- foldrWithKey :: (Key -> v -> a -> a) -> a -> KeyMap v -> a
- foldl' :: (b -> a -> b) -> b -> KeyMap a -> b
- foldl :: (b -> a -> b) -> b -> KeyMap a -> b
- foldr' :: (a -> b -> b) -> b -> KeyMap a -> b
- foldr :: (a -> b -> b) -> b -> KeyMap a -> b
- foldMapWithKey :: Monoid m => (Key -> a -> m) -> KeyMap a -> m
- insert :: Key -> v -> KeyMap v -> KeyMap v
- lookup :: Key -> KeyMap v -> Maybe v
- alterF :: Functor f => (Maybe v -> f (Maybe v)) -> Key -> KeyMap v -> f (KeyMap v)
- delete :: Key -> KeyMap v -> KeyMap v
- member :: Key -> KeyMap a -> Bool
- singleton :: Key -> v -> KeyMap v
- size :: KeyMap v -> Int
- null :: KeyMap v -> Bool
- empty :: KeyMap v
- data KeyMap v
- toKey :: Text -> Key
- toText :: Key -> Text
Documentation
alignWithKey :: (Key -> These a b -> c) -> KeyMap a -> KeyMap b -> KeyMap c #
Generalized union with combining function.
alignWith :: (These a b -> c) -> KeyMap a -> KeyMap b -> KeyMap c #
Generalized union with combining function.
mapMaybeWithKey :: (Key -> v -> Maybe u) -> KeyMap v -> KeyMap u #
Map values and collect the Just results.
filterWithKey :: (Key -> v -> Bool) -> KeyMap v -> KeyMap v #
Filter all keys/values that satisfy some predicate.
mapKeyVal :: (Key -> Key) -> (v1 -> v2) -> KeyMap v1 -> KeyMap v2 #
Transform the keys and values of a KeyMap
.
intersectionWithKey :: (Key -> a -> b -> c) -> KeyMap a -> KeyMap b -> KeyMap c #
The intersection with a combining function.
intersectionWith :: (a -> b -> c) -> KeyMap a -> KeyMap b -> KeyMap c #
The intersection with a combining function.
intersection :: KeyMap a -> KeyMap b -> KeyMap a #
The (left-biased) intersection of two maps (based on keys).
unionWithKey :: (Key -> v -> v -> v) -> KeyMap v -> KeyMap v -> KeyMap v #
The union with a combining function.
unionWith :: (v -> v -> v) -> KeyMap v -> KeyMap v -> KeyMap v #
The union with a combining function.
difference :: KeyMap v -> KeyMap v' -> KeyMap v #
Difference of two maps. Return elements of the first map not existing in the second.
toAscList :: KeyMap v -> [(Key, v)] #
Return a list of this map's elements in ascending order based of the textual key.
toList :: KeyMap v -> [(Key, v)] #
Return a list of this map's keys and elements.
The order is not stable. Use toAscList
for stable ordering.
fromList :: [(Key, v)] -> KeyMap v #
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 #
Construct a map from a list of elements. Uses the provided function, f, to merge duplicate entries with (f newVal oldVal).
traverseWithKey :: Applicative f => (Key -> v1 -> f v2) -> KeyMap v1 -> f (KeyMap v2) #
traverse :: Applicative f => (v1 -> f v2) -> KeyMap v1 -> f (KeyMap v2) #
foldrWithKey :: (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).
foldMapWithKey :: Monoid m => (Key -> a -> m) -> KeyMap a -> m #
insert :: 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.
lookup :: 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.
alterF :: Functor f => (Maybe v -> f (Maybe v)) -> Key -> KeyMap v -> f (KeyMap v) #
alterF
can be used to insert, delete, or update a value in a map.
delete :: Key -> KeyMap v -> KeyMap v #
Remove the mapping for the specified key from this map if present.
A map from JSON key type Key
to v
.
Instances
Functor KeyMap | |
Foldable KeyMap | |
Defined in Data.Aeson.KeyMap fold :: Monoid m => KeyMap m -> m # foldMap :: Monoid m => (a -> m) -> KeyMap a -> m # foldMap' :: Monoid m => (a -> m) -> KeyMap a -> m # foldr :: (a -> b -> b) -> b -> KeyMap a -> b # foldr' :: (a -> b -> b) -> b -> KeyMap a -> b # foldl :: (b -> a -> b) -> b -> KeyMap a -> b # foldl' :: (b -> a -> b) -> b -> KeyMap a -> b # foldr1 :: (a -> a -> a) -> KeyMap a -> a # foldl1 :: (a -> a -> a) -> KeyMap a -> a # elem :: Eq a => a -> KeyMap a -> Bool # maximum :: Ord a => KeyMap a -> a # minimum :: Ord a => KeyMap a -> a # | |
Traversable KeyMap | |
Arbitrary1 KeyMap | Since: aeson-2.0.3.0 |
Defined in Data.Aeson.KeyMap liftArbitrary :: Gen a -> Gen (KeyMap a) # liftShrink :: (a -> [a]) -> KeyMap a -> [KeyMap a] # | |
KeyValue Object | Constructs a singleton |
ToJSON1 KeyMap | |
Defined in Data.Aeson.Types.ToJSON liftToJSON :: (a -> Value) -> ([a] -> Value) -> KeyMap a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [KeyMap a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> KeyMap a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [KeyMap a] -> Encoding # | |
FromJSON1 KeyMap | Since: aeson-2.0.1.0 |
Semialign KeyMap | |
Align KeyMap | |
Defined in Data.Aeson.KeyMap | |
Zip KeyMap | |
Filterable KeyMap | |
Witherable KeyMap | |
Defined in Data.Aeson.KeyMap wither :: Applicative f => (a -> f (Maybe b)) -> KeyMap a -> f (KeyMap b) # witherM :: Monad m => (a -> m (Maybe b)) -> KeyMap a -> m (KeyMap b) # filterA :: Applicative f => (a -> f Bool) -> KeyMap a -> f (KeyMap a) # witherMap :: Applicative m => (KeyMap b -> r) -> (a -> m (Maybe b)) -> KeyMap a -> m r # | |
FunctorWithIndex Key KeyMap | |
FoldableWithIndex Key KeyMap | |
Defined in Data.Aeson.KeyMap | |
TraversableWithIndex Key KeyMap | |
Defined in Data.Aeson.KeyMap | |
SemialignWithIndex Key KeyMap | |
Defined in Data.Aeson.KeyMap | |
ZipWithIndex Key KeyMap | |
FilterableWithIndex Key KeyMap | |
WitherableWithIndex Key KeyMap | |
Lift v => Lift (KeyMap v :: Type) | |
IsList (KeyMap v) | Since: aeson-2.0.2.0 |
Eq v => Eq (KeyMap v) | |
Data v => Data (KeyMap v) | |
Defined in Data.Aeson.KeyMap gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> KeyMap v -> c (KeyMap v) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (KeyMap v) # toConstr :: KeyMap v -> Constr # dataTypeOf :: KeyMap v -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (KeyMap v)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (KeyMap v)) # gmapT :: (forall b. Data b => b -> b) -> KeyMap v -> KeyMap v # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> KeyMap v -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> KeyMap v -> r # gmapQ :: (forall d. Data d => d -> u) -> KeyMap v -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> KeyMap v -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> KeyMap v -> m (KeyMap v) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> KeyMap v -> m (KeyMap v) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> KeyMap v -> m (KeyMap v) # | |
Ord v => Ord (KeyMap v) | |
Defined in Data.Aeson.KeyMap | |
Read v => Read (KeyMap v) | |
Show v => Show (KeyMap v) | |
Semigroup (KeyMap v) | |
Monoid (KeyMap v) | |
Function v => Function (KeyMap v) | Since: aeson-2.0.3.0 |
Arbitrary v => Arbitrary (KeyMap v) | Since: aeson-2.0.3.0 |
CoArbitrary v => CoArbitrary (KeyMap v) | Since: aeson-2.0.3.0 |
Defined in Data.Aeson.KeyMap coarbitrary :: KeyMap v -> Gen b -> Gen b # | |
Hashable v => Hashable (KeyMap v) | |
Defined in Data.Aeson.KeyMap | |
ToJSON v => ToJSON (KeyMap v) | |
Defined in Data.Aeson.Types.ToJSON | |
FromJSON v => FromJSON (KeyMap v) | Since: aeson-2.0.1.0 |
NFData v => NFData (KeyMap v) | |
Defined in Data.Aeson.KeyMap | |
type Item (KeyMap v) | |
Defined in Data.Aeson.KeyMap |