Copyright | Copyright 2022 Shea Levy. |
---|---|
License | Apache-2.0 |
Maintainer | shea@shealevy.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- application :: EventBackend IO r ServeRequest -> (r -> Application) -> Application
- data ServeRequest f where
- renderServeRequest :: RenderSelectorJSON ServeRequest
- data RequestField
- renderRequestField :: RenderFieldJSON RequestField
- onExceptionCallback :: EventBackend IO r OnException -> Maybe Request -> SomeException -> IO ()
- data OnException f where
- renderOnException :: Exception stex => RenderExJSON stex -> RenderSelectorJSON OnException
- data OnExceptionField = OnExceptionField (Maybe Request) SomeException
- renderOnExceptionField :: Exception stex => RenderExJSON stex -> RenderFieldJSON OnExceptionField
- renderRequest :: Request -> Value
Application
:: EventBackend IO r ServeRequest | |
-> (r -> Application) | The application, called with a reference to the parent event. |
-> Application |
Run an Application
with generic Request
/Response
instrumentation.
Instrumentation
data ServeRequest f where Source #
Event selector for application
.
renderServeRequest :: RenderSelectorJSON ServeRequest Source #
Render a ServeRequest
, and any Event
s selected by it, to JSON
renderRequestField :: RenderFieldJSON RequestField Source #
Render a RequestField
to JSON
setOnException
onExceptionCallback :: EventBackend IO r OnException -> Maybe Request -> SomeException -> IO () Source #
A setOnException
callback which creates an Event
rendering
Exception
s.
Ideally this would have a way to get a parent Event
from application
. Would be nice to
use vault
, but there doesn't seem to be a way to get at the Request
that Warp will pass
here.
Instrumentation
data OnException f where Source #
Selector for onException
renderOnException :: Exception stex => RenderExJSON stex -> RenderSelectorJSON OnException Source #
Render an OnException
, and its selected-for Event
s, as JSON, with a provided base structured exception type.
data OnExceptionField Source #
A field for a OnException
Event
.
renderOnExceptionField :: Exception stex => RenderExJSON stex -> RenderFieldJSON OnExceptionField Source #
Render an OnExceptionField
as JSON, with a provided base structured exception type.