json-syntax-0.1.1.0: High-performance JSON parser and encoder

Safe HaskellNone
LanguageHaskell2010

Json

Contents

Synopsis

Types

data Value Source #

The JSON syntax tree described by the ABNF in RFC 7159. Notable design decisions include:

  • True and False are their own data constructors rather than being lumped together under a data constructor for boolean values. This improves performance when decoding the syntax tree to a Bool.
  • Object uses an association list rather than a hash map. This is the data type that key-value pairs can be parsed into most cheaply.
  • Object and Array both use Chunks rather than using SmallArray or cons-list directly. This a middle ground between those two types. We get the efficent use of cache lines that SmallArray offers, and we get the worst-case O(1) appends that cons-list offers. Users will typically fold over the elements with the Foldable instance of Chunks, although there are functions in Data.Chunks that efficently perform other operations.
Instances
Eq Value Source # 
Instance details

Defined in Json

Methods

(==) :: Value -> Value -> Bool #

(/=) :: Value -> Value -> Bool #

Show Value Source # 
Instance details

Defined in Json

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

data Member Source #

A key-value pair in a JSON object. The name of this type is taken from section 4 of RFC 7159.

Constructors

Member 

Fields

Instances
Eq Member Source # 
Instance details

Defined in Json

Methods

(==) :: Member -> Member -> Bool #

(/=) :: Member -> Member -> Bool #

Show Member Source # 
Instance details

Defined in Json

Functions

decode :: Bytes -> Either SyntaxException Value Source #

Decode a JSON syntax tree from a byte sequence.