HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleaeson-2.2.3.0Haskell2010

Data.Aeson.Encoding.Internal

  • 4 types
  • 69 values
  • Packageaeson-2.2.3.0
  • Exports73
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInternal.hs

Encoding

11 declarations
newtypenewtype 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

Instances14KeyValue, KeyValueOmit, SumToJSON', GToJSON', Eq, Ord, …

Make Encoding from Builder.

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

datadata 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)
Instances6Semigroup, Monoid, KeyValue, KeyValueOmit, KeyValuePair, FromPairs

Predicates

1 declaration

Encoding constructors

19 declarations
valuedict
  1. :: (k -> Encoding' Key)

    key encoding

  2. -> (v -> Encoding)

    value encoding

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

    foldrWithKey - indexed fold

  4. -> m

    container

  5. -> Encoding
#

Encode as JSON object

Decimal numbers

valuedouble :: Double -> Encoding
#
Example1 expression
double 42"42.0"
Example1 expression
double (0/0)"null"
Example1 expression
double (1/0)"\"+inf\""
Example1 expression
double (-23/0)"\"-inf\""

Decimal numbers as Text

valuedoubleText :: Double -> Encoding' a
#
Example1 expression
doubleText 42"\"42.0\""
Example1 expression
doubleText (0/0)"\"NaN\""
Example1 expression
doubleText (1/0)"\"+inf\""
Example1 expression
doubleText (-23/0)"\"-inf\""

Time

value

JSON tokens