Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Definitions of JSON AST in terms of the "aeson" package.
This module is intended to be imported unqualified. It is obliged by the package policy to never pollute the namespace.
The naming policy that we use here:
- Constructors are to be suffixed with the type name. Read the name as answering the question of what instance of the type it is. E.g.,
ObjectJson
, standing for an object kind of JSON. - Subtypes are to be prefixed with the parent type. Read the name as a path. E.g.,
JsonObject
stands forJson/Object
.
This policy is pretty universal and it has been applied successfully to disambiguate very large models.
Synopsis
- type Json = Value
- pattern ObjectJson :: JsonObject -> Json
- pattern ArrayJson :: JsonArray -> Json
- pattern StringJson :: Text -> Json
- pattern NumberJson :: Scientific -> Json
- pattern BoolJson :: Bool -> Json
- pattern NullJson :: Json
- type JsonObject = KeyMap Json
- type JsonObjectKey = Key
- type JsonArray = Vector Json
Json type
Alias to JSON AST representation in terms of the "aeson" package.
Together with the associated pattern synonym definitions that are defined in this module this type provides virtually the same API as the following definition:
data Json = ObjectJson (KeyMap Json) | ArrayJson (Vector Json) | StringJson Text | NumberJson Scientific | BoolJson Bool | NullJson
At the same time being just an alias it is completely interchangeable with the Value
definition from "aeson" at zero runtime cost.
Json pattern synonyms
pattern ObjectJson :: JsonObject -> Json Source #
Alias to the Object
constructor and its pattern.
pattern NumberJson :: Scientific -> Json Source #
Alias to the Number
constructor and its pattern.
Other types
type JsonObject = KeyMap Json Source #
Alias to JSON Object AST.
type JsonObjectKey = Key Source #
Alias to key for JsonObject
.