Data.Aeson.Decoding.Tokens

aeson-2.2.3.0: Fast JSON parsing and encoding

Safe Haskell | None
Language | Haskell2010

Data.Aeson.Decoding.Tokens

Contents

- Types

Description

Token definitions.

Synopsis

- data Tokens k e
  - = TkLit !Lit k
  - | TkText !Text k
  - | TkNumber !Number k
  - | TkArrayOpen (TkArray k e)
  - | TkRecordOpen (TkRecord k e)
  - | TkErr e
- data Lit
  - = LitNull
  - | LitTrue
  - | LitFalse
- data Number
  - = NumInteger !Integer
  - | NumDecimal !Scientific
  - | NumScientific !Scientific
- data TkArray k e
  - = TkItem (Tokens (TkArray k e) e)
  - | TkArrayEnd k
  - | TkArrayErr e
- data TkRecord k e
  - = TkPair !Key (Tokens (TkRecord k e) e)
  - | TkRecordEnd k
  - | TkRecordErr e

# Types

data Tokens k e #

A well-formed JSON token stream.

Note: `Lit` exists to make `Tokens` have only 6 constructors. This may or may not have impact on performance.

Since: 2.1.2.0

Constructors

TkLit !Lit k |
TkText !Text k |
TkNumber !Number k |
TkArrayOpen (TkArray k e) |
TkRecordOpen (TkRecord k e) |
TkErr e |

#### Instances

Instances details

Bifoldable Tokens # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bifold :: Monoid m => Tokens m m -> m # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> Tokens a b -> m # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Tokens a b -> c # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Tokens a b -> c #
Bifunctor Tokens # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bimap :: (a -> b) -> (c -> d) -> Tokens a c -> Tokens b d # first :: (a -> b) -> Tokens a c -> Tokens b c # second :: (b -> c) -> Tokens a b -> Tokens a c #
Bitraversable Tokens # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Tokens a b -> f (Tokens c d) #
Functor (Tokens k) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods fmap :: (a -> b) -> Tokens k a -> Tokens k b # (<$) :: a -> Tokens k b -> Tokens k a #
Foldable (Tokens k) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods fold :: Monoid m => Tokens k m -> m # foldMap :: Monoid m => (a -> m) -> Tokens k a -> m # foldMap' :: Monoid m => (a -> m) -> Tokens k a -> m # foldr :: (a -> b -> b) -> b -> Tokens k a -> b # foldr' :: (a -> b -> b) -> b -> Tokens k a -> b # foldl :: (b -> a -> b) -> b -> Tokens k a -> b # foldl' :: (b -> a -> b) -> b -> Tokens k a -> b # foldr1 :: (a -> a -> a) -> Tokens k a -> a # foldl1 :: (a -> a -> a) -> Tokens k a -> a # toList :: Tokens k a -> [a] # null :: Tokens k a -> Bool # length :: Tokens k a -> Int # elem :: Eq a => a -> Tokens k a -> Bool # maximum :: Ord a => Tokens k a -> a # minimum :: Ord a => Tokens k a -> a # sum :: Num a => Tokens k a -> a # product :: Num a => Tokens k a -> a #
Traversable (Tokens k) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods traverse :: Applicative f => (a -> f b) -> Tokens k a -> f (Tokens k b) # sequenceA :: Applicative f => Tokens k (f a) -> f (Tokens k a) # mapM :: Monad m => (a -> m b) -> Tokens k a -> m (Tokens k b) # sequence :: Monad m => Tokens k (m a) -> m (Tokens k a) #
(Show k, Show e) => Show (Tokens k e) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods showsPrec :: Int -> Tokens k e -> ShowS # show :: Tokens k e -> String # showList :: [Tokens k e] -> ShowS #
(Eq k, Eq e) => Eq (Tokens k e) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods (==) :: Tokens k e -> Tokens k e -> Bool # (/=) :: Tokens k e -> Tokens k e -> Bool #

data Lit #

Literals. `null`, `true`, `false`.

Constructors

LitNull |
LitTrue |
LitFalse |

#### Instances

Instances details

Show Lit # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods showsPrec :: Int -> Lit -> ShowS # show :: Lit -> String # showList :: [Lit] -> ShowS #
Eq Lit # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods (==) :: Lit -> Lit -> Bool # (/=) :: Lit -> Lit -> Bool #

data Number #

Numbers

We preserve whether the number was integral, decimal or in scientific form.

Constructors

NumInteger !Integer | e.g. `123`
NumDecimal !Scientific | e.g. `123.456`
NumScientific !Scientific | e.g. `123e456`, `123e-456` or `123.456E-967`

#### Instances

Instances details

Show Number # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods showsPrec :: Int -> Number -> ShowS # show :: Number -> String # showList :: [Number] -> ShowS #
Eq Number # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods (==) :: Number -> Number -> Bool # (/=) :: Number -> Number -> Bool #

data TkArray k e #

Array tokens.

Constructors

TkItem (Tokens (TkArray k e) e) |
TkArrayEnd k |
TkArrayErr e |

#### Instances

Instances details

Bifoldable TkArray # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bifold :: Monoid m => TkArray m m -> m # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> TkArray a b -> m # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> TkArray a b -> c # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> TkArray a b -> c #
Bifunctor TkArray # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bimap :: (a -> b) -> (c -> d) -> TkArray a c -> TkArray b d # first :: (a -> b) -> TkArray a c -> TkArray b c # second :: (b -> c) -> TkArray a b -> TkArray a c #
Bitraversable TkArray # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> TkArray a b -> f (TkArray c d) #
Functor (TkArray k) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods fmap :: (a -> b) -> TkArray k a -> TkArray k b # (<$) :: a -> TkArray k b -> TkArray k a #
Foldable (TkArray k) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods fold :: Monoid m => TkArray k m -> m # foldMap :: Monoid m => (a -> m) -> TkArray k a -> m # foldMap' :: Monoid m => (a -> m) -> TkArray k a -> m # foldr :: (a -> b -> b) -> b -> TkArray k a -> b # foldr' :: (a -> b -> b) -> b -> TkArray k a -> b # foldl :: (b -> a -> b) -> b -> TkArray k a -> b # foldl' :: (b -> a -> b) -> b -> TkArray k a -> b # foldr1 :: (a -> a -> a) -> TkArray k a -> a # foldl1 :: (a -> a -> a) -> TkArray k a -> a # toList :: TkArray k a -> [a] # null :: TkArray k a -> Bool # length :: TkArray k a -> Int # elem :: Eq a => a -> TkArray k a -> Bool # maximum :: Ord a => TkArray k a -> a # minimum :: Ord a => TkArray k a -> a # sum :: Num a => TkArray k a -> a # product :: Num a => TkArray k a -> a #
Traversable (TkArray k) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods traverse :: Applicative f => (a -> f b) -> TkArray k a -> f (TkArray k b) # sequenceA :: Applicative f => TkArray k (f a) -> f (TkArray k a) # mapM :: Monad m => (a -> m b) -> TkArray k a -> m (TkArray k b) # sequence :: Monad m => TkArray k (m a) -> m (TkArray k a) #
(Show k, Show e) => Show (TkArray k e) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods showsPrec :: Int -> TkArray k e -> ShowS # show :: TkArray k e -> String # showList :: [TkArray k e] -> ShowS #
(Eq k, Eq e) => Eq (TkArray k e) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods (==) :: TkArray k e -> TkArray k e -> Bool # (/=) :: TkArray k e -> TkArray k e -> Bool #

data TkRecord k e #

Record tokens.

Constructors

TkPair !Key (Tokens (TkRecord k e) e) |
TkRecordEnd k |
TkRecordErr e |

#### Instances

Instances details

Bifoldable TkRecord # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bifold :: Monoid m => TkRecord m m -> m # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> TkRecord a b -> m # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> TkRecord a b -> c # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> TkRecord a b -> c #
Bifunctor TkRecord # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bimap :: (a -> b) -> (c -> d) -> TkRecord a c -> TkRecord b d # first :: (a -> b) -> TkRecord a c -> TkRecord b c # second :: (b -> c) -> TkRecord a b -> TkRecord a c #
Bitraversable TkRecord # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> TkRecord a b -> f (TkRecord c d) #
Functor (TkRecord k) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods fmap :: (a -> b) -> TkRecord k a -> TkRecord k b # (<$) :: a -> TkRecord k b -> TkRecord k a #
Foldable (TkRecord k) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods fold :: Monoid m => TkRecord k m -> m # foldMap :: Monoid m => (a -> m) -> TkRecord k a -> m # foldMap' :: Monoid m => (a -> m) -> TkRecord k a -> m # foldr :: (a -> b -> b) -> b -> TkRecord k a -> b # foldr' :: (a -> b -> b) -> b -> TkRecord k a -> b # foldl :: (b -> a -> b) -> b -> TkRecord k a -> b # foldl' :: (b -> a -> b) -> b -> TkRecord k a -> b # foldr1 :: (a -> a -> a) -> TkRecord k a -> a # foldl1 :: (a -> a -> a) -> TkRecord k a -> a # toList :: TkRecord k a -> [a] # null :: TkRecord k a -> Bool # length :: TkRecord k a -> Int # elem :: Eq a => a -> TkRecord k a -> Bool # maximum :: Ord a => TkRecord k a -> a # minimum :: Ord a => TkRecord k a -> a # sum :: Num a => TkRecord k a -> a # product :: Num a => TkRecord k a -> a #
Traversable (TkRecord k) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods traverse :: Applicative f => (a -> f b) -> TkRecord k a -> f (TkRecord k b) # sequenceA :: Applicative f => TkRecord k (f a) -> f (TkRecord k a) # mapM :: Monad m => (a -> m b) -> TkRecord k a -> m (TkRecord k b) # sequence :: Monad m => TkRecord k (m a) -> m (TkRecord k a) #
(Show k, Show e) => Show (TkRecord k e) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods showsPrec :: Int -> TkRecord k e -> ShowS # show :: TkRecord k e -> String # showList :: [TkRecord k e] -> ShowS #
(Eq k, Eq e) => Eq (TkRecord k e) # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods (==) :: TkRecord k e -> TkRecord k e -> Bool # (/=) :: TkRecord k e -> TkRecord k e -> Bool #