aeson-2.1.2.1: Fast JSON parsing and encoding

Safe Haskell | Safe-Inferred
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 Source #

#### Instances

Instances details

Arbitrary Key Source # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Key Methods arbitrary :: Gen Key Source # shrink :: Key -> [Key] Source #
CoArbitrary Key Source # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Key Methods coarbitrary :: Key -> Gen b -> Gen b Source #
Function Key Source # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Key Methods function :: (Key -> b) -> Key :-> b Source #
FromJSON Key Source # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Key Source # parseJSONList :: Value -> Parser [Key] Source #
FromJSONKey Key Source # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Key Source # fromJSONKeyList :: FromJSONKeyFunction [Key] Source #
ToJSON Key Source # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Key -> Value Source # toEncoding :: Key -> Encoding Source # toJSONList :: [Key] -> Value Source # toEncodingList :: [Key] -> Encoding Source #
ToJSONKey Key Source # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Key Source # toJSONKeyList :: ToJSONKeyFunction [Key] Source #
Data Key Source # |

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 Source #

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

toConstr :: Key -> Constr Source #

dataTypeOf :: Key -> DataType Source #

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

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

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

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

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

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

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

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

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

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

IsString Key Source # |
Instance details Defined in Data.Aeson.Key Methods fromString :: String -> Key Source #
Monoid Key Source # |
Instance details Defined in Data.Aeson.Key Methods mempty :: Key Source # mappend :: Key -> Key -> Key Source # mconcat :: [Key] -> Key Source #
Semigroup Key Source # |
Instance details Defined in Data.Aeson.Key Methods (<>) :: Key -> Key -> Key Source # sconcat :: NonEmpty Key -> Key Source # stimes :: Integral b => b -> Key -> Key Source #
Read Key Source # |
Instance details Defined in Data.Aeson.Key Methods readsPrec :: Int -> ReadS Key Source # readList :: ReadS [Key] Source # readPrec :: ReadPrec Key Source # readListPrec :: ReadPrec [Key] Source #
Show Key Source # |
Instance details Defined in Data.Aeson.Key Methods showsPrec :: Int -> Key -> ShowS Source # show :: Key -> String Source # showList :: [Key] -> ShowS Source #
NFData Key Source # |
Instance details Defined in Data.Aeson.Key Methods rnf :: Key -> () Source #
Eq Key Source # |
Instance details Defined in Data.Aeson.Key Methods (==) :: Key -> Key -> Bool Source # (/=) :: Key -> Key -> Bool Source #
Ord Key Source # |
Instance details Defined in Data.Aeson.Key Methods compare :: Key -> Key -> Ordering Source # (<) :: Key -> Key -> Bool Source # (<=) :: Key -> Key -> Bool Source # (>) :: Key -> Key -> Bool Source # (>=) :: Key -> Key -> Bool Source # max :: Key -> Key -> Key Source # min :: Key -> Key -> Key Source #
Hashable Key Source # |
Instance details Defined in Data.Aeson.Key Methods hashWithSalt :: Int -> Key -> Int Source # hash :: Key -> Int 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 #

FunctorWithIndex Key KeyMap Source # |
Instance details Defined in Data.Aeson.KeyMap Methods imap :: (Key -> a -> b) -> KeyMap a -> KeyMap 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 Methods ialignWith :: (Key -> These a b -> c) -> KeyMap a -> KeyMap b -> KeyMap c Source #
ZipWithIndex Key KeyMap Source # |
Instance details Defined in Data.Aeson.KeyMap Methods izipWith :: (Key -> a -> b -> c) -> KeyMap a -> KeyMap b -> KeyMap c Source #
Lift Key Source # |
Instance details Defined in Data.Aeson.Key Methods lift :: Quote m => Key -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Key -> Code m Key Source #
FilterableWithIndex Key KeyMap Source # |
Instance details Defined in Data.Aeson.KeyMap Methods imapMaybe :: (Key -> a -> Maybe b) -> KeyMap a -> KeyMap b Source # ifilter :: (Key -> a -> Bool) -> KeyMap a -> KeyMap a Source #
WitherableWithIndex Key KeyMap Source # |
Instance details Defined in Data.Aeson.KeyMap Methods iwither :: Applicative f => (Key -> a -> f (Maybe b)) -> KeyMap a -> f (KeyMap b) Source # iwitherM :: Monad m => (Key -> a -> m (Maybe b)) -> KeyMap a -> m (KeyMap b) Source # ifilterA :: Applicative f => (Key -> a -> f Bool) -> KeyMap a -> f (KeyMap a) Source #

fromString :: String -> Key Source #

toString :: Key -> String Source #

toText :: Key -> Text Source #

fromText :: Text -> Key Source #

coercionToText :: Maybe (Coercion Key Text) Source #

`'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 Source #

Since: 2.0.2.0

fromShortText :: ShortText -> Key Source #

Since: 2.0.2.0