Copyright | Copyright 2022 Shea Levy. |
---|---|
License | Apache-2.0 |
Maintainer | shea@shealevy.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- type Application em r s = Request -> (Response -> em r s ResponseReceived) -> em r s ResponseReceived
- application :: (MonadUnliftIO (em r s), MonadWithEvent em) => InjectSelector ServeRequest s -> Application em r s -> em r s Application
- data ServeRequest f where
- renderServeRequest :: RenderSelectorJSON ServeRequest
- data RequestField
- renderRequestField :: RenderFieldJSON RequestField
- type OnExceptionCallback em r s = Maybe Request -> SomeException -> em r s ()
- onExceptionCallback :: (MonadUnliftIO (em r s), MonadWithEvent em) => InjectSelector OnException s -> OnExceptionCallback em r s -> em r s (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
type Application em r s = Request -> (Response -> em r s ResponseReceived) -> em r s ResponseReceived Source #
An instrumented Application
application :: (MonadUnliftIO (em r s), MonadWithEvent em) => InjectSelector ServeRequest s -> Application em r s -> em r s Application Source #
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
type OnExceptionCallback em r s = Maybe Request -> SomeException -> em r s () Source #
An instrumented setOnException
callback.
onExceptionCallback :: (MonadUnliftIO (em r s), MonadWithEvent em) => InjectSelector OnException s -> OnExceptionCallback em r s -> em r s (Maybe Request -> SomeException -> IO ()) Source #
Convert an OnExceptionCallback
to a setOnException
callback.
The OnExceptionCallback
is called as the child of an Event
rendering the exception, if
it's one that should be displayed according to defaultShouldDisplayException
.
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.