aeson-1.5.6.0: Fast JSON parsing and encoding
Safe HaskellNone
LanguageHaskell2010

Data.Aeson.Encoding.Internal

Synopsis

Encoding

newtype Encoding' tag #

An encoding of a JSON value.

tag represents which kind of JSON the Encoding is encoding to, we reuse Text and Value as tags here.

Constructors

Encoding 

Fields

Instances

Instances details
GToJSON' Encoding arity (U1 :: Type -> Type) # 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

gToJSON :: Options -> ToArgs Encoding arity a -> U1 a -> Encoding

ToJSON1 f => GToJSON' Encoding One (Rec1 f) # 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

gToJSON :: Options -> ToArgs Encoding One a -> Rec1 f a -> Encoding

(EncodeProduct arity a, EncodeProduct arity b) => GToJSON' Encoding arity (a :*: b) # 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

gToJSON :: Options -> ToArgs Encoding arity a0 -> (a :*: b) a0 -> Encoding

ToJSON a => GToJSON' Encoding arity (K1 i a :: Type -> Type) # 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

gToJSON :: Options -> ToArgs Encoding arity a0 -> K1 i a a0 -> Encoding

(ToJSON1 f, GToJSON' Encoding One g) => GToJSON' Encoding One (f :.: g) # 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

gToJSON :: Options -> ToArgs Encoding One a -> (f :.: g) a -> Encoding

Eq (Encoding' a) # 
Instance details

Defined in Data.Aeson.Encoding.Internal

Methods

(==) :: Encoding' a -> Encoding' a -> Bool #

(/=) :: Encoding' a -> Encoding' a -> Bool #

Ord (Encoding' a) # 
Instance details

Defined in Data.Aeson.Encoding.Internal

Show (Encoding' a) # 
Instance details

Defined in Data.Aeson.Encoding.Internal

type Encoding = Encoding' Value #

Often used synonym for Encoding'.

unsafeToEncoding :: Builder -> Encoding' a #

Make Encoding from Builder.

Use with care! You have to make sure that the passed Builder is a valid JSON Encoding!

data Series #

A series of values that, when encoded, should be separated by commas. Since 0.11.0.0, the .= operator is overloaded to create either (Text, Value) or Series. You can use Series when encoding directly to a bytestring builder as in the following example:

toEncoding (Person name age) = pairs ("name" .= name <> "age" .= age)

Constructors

Empty 
Value (Encoding' Series) 

Instances

Instances details
Semigroup Series # 
Instance details

Defined in Data.Aeson.Encoding.Internal

Monoid Series # 
Instance details

Defined in Data.Aeson.Encoding.Internal

KeyValue Series # 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

(.=) :: ToJSON v => Text -> v -> Series #

pairs :: Series -> Encoding #

Encode a series of key/value pairs, separated by commas.

Predicates

Encoding constructors

list :: (a -> Encoding) -> [a] -> Encoding #

dict #

Arguments

:: (k -> Encoding' Text)

key encoding

-> (v -> Encoding)

value encoding

-> (forall a. (k -> v -> a -> a) -> a -> m -> a)

foldrWithKey - indexed fold

-> m

container

-> Encoding 

Encode as JSON object

tuple :: Encoding' InArray -> Encoding #

Encode as a tuple.

@ toEncoding (X a b c) = tuple $ toEncoding a >*< toEncoding b >*< toEncoding c

(>*<) :: Encoding' a -> Encoding' b -> Encoding' InArray infixr 6 #

See tuple.

data InArray #

Type tag for tuples contents, see tuple.

(><) :: Encoding' a -> Encoding' a -> Encoding' a infixr 6 #

Decimal numbers

Decimal numbers as Text

Time

day :: Day -> Encoding' a #

value

JSON tokens