eventuo11y-json-0.3.0.2: aeson-based rendering for eventuo11y
CopyrightCopyright 2022 Shea Levy.
LicenseApache-2.0
Maintainershea@shealevy.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Observe.Event.Render.JSON

Description

Rendering types for JSON-consuming EventBackends.

Instances of RenderSelectorJSON and RenderFieldJSON can be generated by Observe.Event.Render.JSON.DSL.Compile.

Synopsis

Documentation

type RenderSelectorJSON sel = forall f. sel f -> (Key, RenderFieldJSON f) Source #

A function to render a given selector, and its fields, as JSON.

The Key is the event name/category.

type RenderFieldJSON field = field -> (Key, Value) Source #

A function to render a given field as JSON.

The Key is a field name, the Value is an arbitrary rendering of the field value (if any).

Default renderers

class DefaultRenderSelectorJSON sel where Source #

A default RenderSelectorJSON, useful for auto-generation and simple backend invocation.

class DefaultRenderFieldJSON field where Source #

A default RenderFieldJSON, useful for auto-generation and simple backend invocation.

Rendering structured exceptions

type RenderExJSON stex = stex -> Value Source #

A function to render a given structured exception to JSON.

SomeJSONException

data SomeJSONException Source #

A possible base type for structured exceptions renderable to JSON.

It is not necessary to use SomeJSONException for the base of your structured exceptions in a JSON backend, so long as you provide a RenderExJSON for your base exception type (or use ToJSON-based rendering).

Constructors

forall e.(Exception e, ToJSON e) => SomeJSONException e 

jsonExceptionToException :: (Exception e, ToJSON e) => e -> SomeException Source #

Used to create sub-classes of SomeJSONException.