servant-checked-exceptions-0.4.1.0: Checked exceptions for Servant APIs.

CopyrightDennis Gosnell 2017
LicenseBSD3
MaintainerDennis Gosnell (cdep.illabout@gmail.com)
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Servant.Checked.Exceptions.Internal.Servant.Docs

Contents

Description

This module exports HasDocs instances for Throws and Throwing.

Synopsis

Documentation

class CreateRespBodiesFor list ctypes where Source #

Create samples for a given list of types, under given ctypes.

Additional instances of this class should not need to be created.

Minimal complete definition

createRespBodiesFor

Methods

createRespBodiesFor :: Proxy list -> Proxy ctypes -> [(Text, MediaType, ByteString)] Source #

Instances

CreateRespBodiesFor k1 [k] ([] k) ctypes Source #

An empty list of types has no samples.

Methods

createRespBodiesFor :: Proxy ctypes list -> Proxy [k] ctypes -> [(Text, MediaType, ByteString)] Source #

(AllMimeRender ctypes (Envelope ((:) * e ([] *)) ()), CreateRespBodiesFor [*] [*] es ctypes, ToSample e) => CreateRespBodiesFor [*] [*] ((:) * e es) ctypes Source #

Create a response body for each of the error types.

Methods

createRespBodiesFor :: Proxy ctypes list -> Proxy ((* ': e) es) ctypes -> [(Text, MediaType, ByteString)] Source #

createRespBodyFor :: forall e ctypes. (AllMimeRender ctypes (Envelope '[e] ()), ToSample e) => Proxy e -> Proxy ctypes -> [(Text, MediaType, ByteString)] Source #

Create a sample for a given e under given ctypes.

Orphan instances

HasDocs * ((:>) k * (Throwing (Snoc * es e)) api) => HasDocs * ((:>) * * (Throwing es) ((:>) k * (Throws e) api)) Source #

When a Throws e comes immediately after a Throwing es, Snoc the e onto the es.

Methods

docsFor :: Proxy ((* :> *) (Throwing es) ((k :> *) (Throws e) api)) api -> (Endpoint, Action) -> DocOptions -> API #

(CreateRespBodiesFor [*] [*] es ctypes, HasDocs * (Verb * k1 method status ctypes (Envelope es a))) => HasDocs * ((:>) * * (Throwing es) (Verb * k1 method status ctypes a)) Source #

When Throwing es comes before a Verb, generate the documentation for the same Verb, but returning an Envelope es. Also add documentation for the potential es.

Methods

docsFor :: Proxy ((* :> *) (Throwing es) (Verb * k1 method status ctypes a)) api -> (Endpoint, Action) -> DocOptions -> API #

HasDocs * (Verb * k1 method status ctypes (Envelope ([] *) a)) => HasDocs * ((:>) * * NoThrow (Verb * k1 method status ctypes a)) Source #

When NoThrow comes before a Verb, generate the documentation for the same Verb, but returning an Envelope '[].

Methods

docsFor :: Proxy ((* :> *) NoThrow (Verb * k1 method status ctypes a)) api -> (Endpoint, Action) -> DocOptions -> API #

HasDocs * ((:>) k * (Throwing ((:) * e ([] *))) api) => HasDocs * ((:>) k * (Throws e) api) Source #

Change a Throws into Throwing.

Methods

docsFor :: Proxy ((k :> *) (Throws e) api) api -> (Endpoint, Action) -> DocOptions -> API #

ToSample a => ToSample (Envelope es a) Source #

We can generate a sample of an Envelope es a as long as there is a way to generate a sample of the a.

This doesn't need to worry about generating a sample of es, because that is taken care of in the HasDocs instance for Throwing es.

Methods

toSamples :: Proxy * (Envelope es a) -> [(Text, Envelope es a)] #