aeson-2.2.1.0: Fast JSON parsing and encoding

Safe Haskell | None
Language | Haskell2010

Data.Aeson.Key

Description

Strong type for JSON keys.

Since: 2.0.0.0

Synopsis

- data Key
- fromString :: String -> Key
- toString :: Key -> String
- toText :: Key -> Text
- fromText :: Text -> Key
- coercionToText :: Maybe (Coercion Key Text)
- toShortText :: Key -> ShortText
- fromShortText :: ShortText -> Key

# Documentation

data Key #

#### Instances

Instances details

Arbitrary Key # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Key Methods arbitrary :: Gen Key # shrink :: Key -> [Key] #
CoArbitrary Key # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Key Methods coarbitrary :: Key -> Gen b -> Gen b #
Function Key # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Key Methods function :: (Key -> b) -> Key :-> b #
FromJSON Key # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Key # parseJSONList :: Value -> Parser [Key] # omittedField :: Maybe Key #
FromJSONKey Key # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Key # fromJSONKeyList :: FromJSONKeyFunction [Key] #
ToJSON Key # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Key -> Value # toEncoding :: Key -> Encoding # toJSONList :: [Key] -> Value # toEncodingList :: [Key] -> Encoding # omitField :: Key -> Bool #
ToJSONKey Key # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Key # toJSONKeyList :: ToJSONKeyFunction [Key] #
Data Key # |
Instance details Defined in Data.Aeson.Key Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Key -> c Key # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Key # toConstr :: Key -> Constr # dataTypeOf :: Key -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Key) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Key) # gmapT :: (forall b. Data b => b -> b) -> Key -> Key # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Key -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Key -> r # gmapQ :: (forall d. Data d => d -> u) -> Key -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Key -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Key -> m Key # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Key -> m Key # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Key -> m Key #
IsString Key # |
Instance details Defined in Data.Aeson.Key Methods fromString :: String -> Key #
Monoid Key # |
Instance details Defined in Data.Aeson.Key Methods mempty :: Key # mappend :: Key -> Key -> Key # mconcat :: [Key] -> Key #
Semigroup Key # |
Instance details Defined in Data.Aeson.Key Methods (<>) :: Key -> Key -> Key # sconcat :: NonEmpty Key -> Key # stimes :: Integral b => b -> Key -> Key #
Read Key # |
Instance details Defined in Data.Aeson.Key Methods readsPrec :: Int -> ReadS Key # readList :: ReadS [Key] # readPrec :: ReadPrec Key # readListPrec :: ReadPrec [Key] #
Show Key # |
Instance details Defined in Data.Aeson.Key Methods showsPrec :: Int -> Key -> ShowS # show :: Key -> String # showList :: [Key] -> ShowS #
NFData Key # |
Instance details Defined in Data.Aeson.Key Methods rnf :: Key -> () #
Eq Key # |
Instance details Defined in Data.Aeson.Key Methods (==) :: Key -> Key -> Bool # (/=) :: Key -> Key -> Bool #
Ord Key # |
Instance details Defined in Data.Aeson.Key Methods compare :: Key -> Key -> Ordering # (<) :: Key -> Key -> Bool # (<=) :: Key -> Key -> Bool # (>) :: Key -> Key -> Bool # (>=) :: Key -> Key -> Bool # max :: Key -> Key -> Key # min :: Key -> Key -> Key #
Hashable Key # |
Instance details Defined in Data.Aeson.Key Methods hashWithSalt :: Int -> Key -> Int # hash :: Key -> Int #
FoldableWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods ifoldMap :: Monoid m => (Key -> a -> m) -> KeyMap a -> m # ifoldMap' :: Monoid m => (Key -> a -> m) -> KeyMap a -> m # ifoldr :: (Key -> a -> b -> b) -> b -> KeyMap a -> b # ifoldl :: (Key -> b -> a -> b) -> b -> KeyMap a -> b # ifoldr' :: (Key -> a -> b -> b) -> b -> KeyMap a -> b # ifoldl' :: (Key -> b -> a -> b) -> b -> KeyMap a -> b #
FunctorWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods imap :: (Key -> a -> b) -> KeyMap a -> KeyMap b #
TraversableWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods itraverse :: Applicative f => (Key -> a -> f b) -> KeyMap a -> f (KeyMap b) #
SemialignWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods ialignWith :: (Key -> These a b -> c) -> KeyMap a -> KeyMap b -> KeyMap c #
ZipWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods izipWith :: (Key -> a -> b -> c) -> KeyMap a -> KeyMap b -> KeyMap c #
Lift Key # |
Instance details Defined in Data.Aeson.Key Methods lift :: Quote m => Key -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Key -> Code m Key #
FilterableWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods imapMaybe :: (Key -> a -> Maybe b) -> KeyMap a -> KeyMap b # ifilter :: (Key -> a -> Bool) -> KeyMap a -> KeyMap a #
WitherableWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods iwither :: Applicative f => (Key -> a -> f (Maybe b)) -> KeyMap a -> f (KeyMap b) # iwitherM :: Monad m => (Key -> a -> m (Maybe b)) -> KeyMap a -> m (KeyMap b) # ifilterA :: Applicative f => (Key -> a -> f Bool) -> KeyMap a -> f (KeyMap a) #

fromString :: String -> Key #

toString :: Key -> String #

toText :: Key -> Text #

fromText :: Text -> Key #

coercionToText :: Maybe (Coercion Key Text) #

`'coercing r1 r2'` will evaluate to `r1` if `Key` is `Coercible` to `Text`, and to `r2` otherwise.

Using `coercing` we can make more efficient implementations when `Key` is backed up by `Text` without exposing internals.

toShortText :: Key -> ShortText #

Since: 2.0.2.0

fromShortText :: ShortText -> Key #

Since: 2.0.2.0