aeson-2.1.2.1: Fast JSON parsing and encoding

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

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 Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bifold :: Monoid m => Tokens m m -> m Source # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> Tokens a b -> m Source # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Tokens a b -> c Source # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Tokens a b -> c Source #
Bifunctor Tokens Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bimap :: (a -> b) -> (c -> d) -> Tokens a c -> Tokens b d Source # first :: (a -> b) -> Tokens a c -> Tokens b c Source # second :: (b -> c) -> Tokens a b -> Tokens a c Source #
Bitraversable Tokens Source # |
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) Source #
Foldable (Tokens k) Source # |

Instance details

Defined in Data.Aeson.Decoding.Tokens

Methods

fold :: Monoid m => Tokens k m -> m Source #

foldMap :: Monoid m => (a -> m) -> Tokens k a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Tokens k a -> m Source #

foldr :: (a -> b -> b) -> b -> Tokens k a -> b Source #

foldr' :: (a -> b -> b) -> b -> Tokens k a -> b Source #

foldl :: (b -> a -> b) -> b -> Tokens k a -> b Source #

foldl' :: (b -> a -> b) -> b -> Tokens k a -> b Source #

foldr1 :: (a -> a -> a) -> Tokens k a -> a Source #

foldl1 :: (a -> a -> a) -> Tokens k a -> a Source #

toList :: Tokens k a -> [a] Source #

null :: Tokens k a -> Bool Source #

length :: Tokens k a -> Int Source #

elem :: Eq a => a -> Tokens k a -> Bool Source #

maximum :: Ord a => Tokens k a -> a Source #

minimum :: Ord a => Tokens k a -> a Source #

sum :: Num a => Tokens k a -> a Source #

product :: Num a => Tokens k a -> a Source #

Traversable (Tokens k) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods traverse :: Applicative f => (a -> f b) -> Tokens k a -> f (Tokens k b) Source # sequenceA :: Applicative f => Tokens k (f a) -> f (Tokens k a) Source # mapM :: Monad m => (a -> m b) -> Tokens k a -> m (Tokens k b) Source # sequence :: Monad m => Tokens k (m a) -> m (Tokens k a) Source #
Functor (Tokens k) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods fmap :: (a -> b) -> Tokens k a -> Tokens k b Source # (<$) :: a -> Tokens k b -> Tokens k a Source #
(Show k, Show e) => Show (Tokens k e) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods showsPrec :: Int -> Tokens k e -> ShowS Source # show :: Tokens k e -> String Source # showList :: [Tokens k e] -> ShowS Source #
(Eq k, Eq e) => Eq (Tokens k e) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods (==) :: Tokens k e -> Tokens k e -> Bool Source # (/=) :: Tokens k e -> Tokens k e -> Bool Source #

data Lit Source #

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

Constructors

LitNull |
LitTrue |
LitFalse |

#### Instances

Instances details

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

data Number Source #

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

data TkArray k e Source #

Array tokens.

Constructors

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

#### Instances

Instances details

Bifoldable TkArray Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bifold :: Monoid m => TkArray m m -> m Source # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> TkArray a b -> m Source # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> TkArray a b -> c Source # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> TkArray a b -> c Source #
Bifunctor TkArray Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bimap :: (a -> b) -> (c -> d) -> TkArray a c -> TkArray b d Source # first :: (a -> b) -> TkArray a c -> TkArray b c Source # second :: (b -> c) -> TkArray a b -> TkArray a c Source #
Bitraversable TkArray Source # |
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) Source #
Foldable (TkArray k) Source # |

Instance details

Defined in Data.Aeson.Decoding.Tokens

Methods

fold :: Monoid m => TkArray k m -> m Source #

foldMap :: Monoid m => (a -> m) -> TkArray k a -> m Source #

foldMap' :: Monoid m => (a -> m) -> TkArray k a -> m Source #

foldr :: (a -> b -> b) -> b -> TkArray k a -> b Source #

foldr' :: (a -> b -> b) -> b -> TkArray k a -> b Source #

foldl :: (b -> a -> b) -> b -> TkArray k a -> b Source #

foldl' :: (b -> a -> b) -> b -> TkArray k a -> b Source #

foldr1 :: (a -> a -> a) -> TkArray k a -> a Source #

foldl1 :: (a -> a -> a) -> TkArray k a -> a Source #

toList :: TkArray k a -> [a] Source #

null :: TkArray k a -> Bool Source #

length :: TkArray k a -> Int Source #

elem :: Eq a => a -> TkArray k a -> Bool Source #

maximum :: Ord a => TkArray k a -> a Source #

minimum :: Ord a => TkArray k a -> a Source #

sum :: Num a => TkArray k a -> a Source #

product :: Num a => TkArray k a -> a Source #

Traversable (TkArray k) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods traverse :: Applicative f => (a -> f b) -> TkArray k a -> f (TkArray k b) Source # sequenceA :: Applicative f => TkArray k (f a) -> f (TkArray k a) Source # mapM :: Monad m => (a -> m b) -> TkArray k a -> m (TkArray k b) Source # sequence :: Monad m => TkArray k (m a) -> m (TkArray k a) Source #
Functor (TkArray k) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods fmap :: (a -> b) -> TkArray k a -> TkArray k b Source # (<$) :: a -> TkArray k b -> TkArray k a Source #
(Show k, Show e) => Show (TkArray k e) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods showsPrec :: Int -> TkArray k e -> ShowS Source # show :: TkArray k e -> String Source # showList :: [TkArray k e] -> ShowS Source #
(Eq k, Eq e) => Eq (TkArray k e) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods (==) :: TkArray k e -> TkArray k e -> Bool Source # (/=) :: TkArray k e -> TkArray k e -> Bool Source #

data TkRecord k e Source #

Record tokens.

Constructors

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

#### Instances

Instances details

Bifoldable TkRecord Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bifold :: Monoid m => TkRecord m m -> m Source # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> TkRecord a b -> m Source # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> TkRecord a b -> c Source # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> TkRecord a b -> c Source #
Bifunctor TkRecord Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods bimap :: (a -> b) -> (c -> d) -> TkRecord a c -> TkRecord b d Source # first :: (a -> b) -> TkRecord a c -> TkRecord b c Source # second :: (b -> c) -> TkRecord a b -> TkRecord a c Source #
Bitraversable TkRecord Source # |
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) Source #
Foldable (TkRecord k) Source # |

Instance details

Defined in Data.Aeson.Decoding.Tokens

Methods

fold :: Monoid m => TkRecord k m -> m Source #

foldMap :: Monoid m => (a -> m) -> TkRecord k a -> m Source #

foldMap' :: Monoid m => (a -> m) -> TkRecord k a -> m Source #

foldr :: (a -> b -> b) -> b -> TkRecord k a -> b Source #

foldr' :: (a -> b -> b) -> b -> TkRecord k a -> b Source #

foldl :: (b -> a -> b) -> b -> TkRecord k a -> b Source #

foldl' :: (b -> a -> b) -> b -> TkRecord k a -> b Source #

foldr1 :: (a -> a -> a) -> TkRecord k a -> a Source #

foldl1 :: (a -> a -> a) -> TkRecord k a -> a Source #

toList :: TkRecord k a -> [a] Source #

null :: TkRecord k a -> Bool Source #

length :: TkRecord k a -> Int Source #

elem :: Eq a => a -> TkRecord k a -> Bool Source #

maximum :: Ord a => TkRecord k a -> a Source #

minimum :: Ord a => TkRecord k a -> a Source #

sum :: Num a => TkRecord k a -> a Source #

product :: Num a => TkRecord k a -> a Source #

Traversable (TkRecord k) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods traverse :: Applicative f => (a -> f b) -> TkRecord k a -> f (TkRecord k b) Source # sequenceA :: Applicative f => TkRecord k (f a) -> f (TkRecord k a) Source # mapM :: Monad m => (a -> m b) -> TkRecord k a -> m (TkRecord k b) Source # sequence :: Monad m => TkRecord k (m a) -> m (TkRecord k a) Source #
Functor (TkRecord k) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods fmap :: (a -> b) -> TkRecord k a -> TkRecord k b Source # (<$) :: a -> TkRecord k b -> TkRecord k a Source #
(Show k, Show e) => Show (TkRecord k e) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods showsPrec :: Int -> TkRecord k e -> ShowS Source # show :: TkRecord k e -> String Source # showList :: [TkRecord k e] -> ShowS Source #
(Eq k, Eq e) => Eq (TkRecord k e) Source # |
Instance details Defined in Data.Aeson.Decoding.Tokens Methods (==) :: TkRecord k e -> TkRecord k e -> Bool Source # (/=) :: TkRecord k e -> TkRecord k e -> Bool Source #