| Copyright | Copyright 2022 Shea Levy. |
|---|---|
| License | Apache-2.0 |
| Maintainer | shea@shealevy.com |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
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
- type RenderSelectorJSON sel = forall f. sel f -> (Key, RenderFieldJSON f)
- type RenderFieldJSON field = field -> (Key, Value)
- class DefaultRenderSelectorJSON sel where
- class DefaultRenderFieldJSON field where
- defaultRenderFieldJSON :: RenderFieldJSON field
- type RenderExJSON stex = stex -> Value
- data SomeJSONException = forall e.(Exception e, ToJSON e) => SomeJSONException e
- jsonExceptionToException :: (Exception e, ToJSON e) => e -> SomeException
- jsonExceptionFromException :: Exception e => SomeException -> Maybe e
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 #
Default renderers
class DefaultRenderSelectorJSON sel where Source #
A default RenderSelectorJSON, useful for auto-generation and simple
backend invocation.
Methods
defaultRenderSelectorJSON :: RenderSelectorJSON sel Source #
Instances
class DefaultRenderFieldJSON field where Source #
A default RenderFieldJSON, useful for auto-generation and simple
backend invocation.
Methods
defaultRenderFieldJSON :: RenderFieldJSON field Source #
Instances
| DefaultRenderFieldJSON Void Source # | |
Defined in Observe.Event.Render.JSON Methods | |
| DefaultRenderFieldJSON DynamicField Source # | |
Defined in Observe.Event.Render.JSON Methods defaultRenderFieldJSON :: RenderFieldJSON DynamicField Source # | |
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 |
Instances
| ToJSON SomeJSONException Source # | |
Defined in Observe.Event.Render.JSON Methods toJSON :: SomeJSONException -> Value # toEncoding :: SomeJSONException -> Encoding # toJSONList :: [SomeJSONException] -> Value # toEncodingList :: [SomeJSONException] -> Encoding # | |
| Exception SomeJSONException Source # | |
Defined in Observe.Event.Render.JSON Methods toException :: SomeJSONException -> SomeException # | |
| Show SomeJSONException Source # | |
Defined in Observe.Event.Render.JSON Methods showsPrec :: Int -> SomeJSONException -> ShowS # show :: SomeJSONException -> String # showList :: [SomeJSONException] -> ShowS # | |
jsonExceptionToException :: (Exception e, ToJSON e) => e -> SomeException Source #
Used to create sub-classes of SomeJSONException.
jsonExceptionFromException :: Exception e => SomeException -> Maybe e Source #
Used to create sub-classes of SomeJSONException.