-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | High-performance JSON parser
--
-- This library parses JSON into a Value type that is consistent
-- with the ABNF described in RFC 7159. The parser is about six
-- times faster than the parser that aeson provides. This parser
-- is however, non-resumable, so if resumable parsing is important,
-- aeson should be preferred.
--
-- This library does not include any functions or typeclasses to help
-- users marshal Value to their application-specific data types.
-- Such functions and typeclasses are outside the scope of this library.
-- If anyone writes a library that offers users these conveniences open a
-- issue so that the json-syntax documentation can point users
-- to it.
@package json-syntax
@version 0.1.0.0
module Json
-- | 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.
--
data Value
Object :: !Chunks Member -> Value
Array :: !Chunks Value -> Value
String :: {-# UNPACK #-} !ShortText -> Value
Number :: {-# UNPACK #-} !Scientific -> Value
Null :: Value
True :: Value
False :: Value
-- | A key-value pair in a JSON object. The name of this type is taken from
-- section 4 of RFC 7159.
data Member
Member :: {-# UNPACK #-} !ShortText -> !Value -> Member
[key] :: Member -> {-# UNPACK #-} !ShortText
[value] :: Member -> !Value
-- | Exceptions that can happen while parsing JSON. Do not pattern match on
-- values of this type. New data constructors may be added at any time
-- without a major version bump.
data SyntaxException
EmptyInput :: SyntaxException
ExpectedColon :: SyntaxException
ExpectedCommaOrRightBracket :: SyntaxException
ExpectedFalse :: SyntaxException
ExpectedNull :: SyntaxException
ExpectedQuote :: SyntaxException
ExpectedQuoteOrRightBrace :: SyntaxException
ExpectedTrue :: SyntaxException
IncompleteArray :: SyntaxException
IncompleteEscapeSequence :: SyntaxException
IncompleteObject :: SyntaxException
IncompleteString :: SyntaxException
InvalidEscapeSequence :: SyntaxException
InvalidLeader :: SyntaxException
InvalidNumber :: SyntaxException
LeadingZero :: SyntaxException
UnexpectedLeftovers :: SyntaxException
-- | Decode a JSON syntax tree from a byte sequence.
decode :: Bytes -> Either SyntaxException Value
instance GHC.Show.Show Json.Value
instance GHC.Classes.Eq Json.Value
instance GHC.Show.Show Json.Member
instance GHC.Classes.Eq Json.Member
instance GHC.Exception.Type.Exception Json.SyntaxException
instance GHC.Show.Show Json.SyntaxException
instance GHC.Classes.Eq Json.SyntaxException