aeson-unqualified-ast-1.0.0.3: Aliases to "aeson" AST making it importable unqualified
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Aeson.UnqualifiedAst

Description

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 for Json/Object.

This policy is pretty universal and it has been applied successfully to disambiguate very large models.

Synopsis

Json type

type Json = Value Source #

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 ArrayJson :: JsonArray -> Json Source #

Alias to the Array constructor and its pattern.

pattern StringJson :: Text -> Json Source #

Alias to the String constructor and its pattern.

pattern NumberJson :: Scientific -> Json Source #

Alias to the Number constructor and its pattern.

pattern BoolJson :: Bool -> Json Source #

Alias to the Bool constructor and its pattern.

pattern NullJson :: Json Source #

Alias to the Null 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.

type JsonArray = Vector Json Source #

Alias to JSON Array AST.