Copyright | Dennis Gosnell 2017 |
---|---|
License | BSD3 |
Maintainer | Dennis Gosnell (cdep.illabout@gmail.com) |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
- data Throws (e :: *)
- data NoThrow
- data Throwing (e :: [*])
- type family ThrowingNonterminal api where ...
- class ErrStatus e where
- type family AllErrStatus (es :: [k]) :: Constraint where ...
Documentation
NoThrow
is used to indicate that an API will not throw an error, but
that it will still return a response wrapped in a
Envelope
.
Examples
Create an API using NoThrow
:
>>>
import Servant.API (Get, JSON, (:>))
>>>
type API = NoThrow :> Get '[JSON] Int
A servant-server handler for this type would look like the following:
apiHandler ::Handler
(Envelope
'[] Int) apiHandler =pureSuccEnvelope
3
type family ThrowingNonterminal api where ... Source #
type family AllErrStatus (es :: [k]) :: Constraint where ... Source #
AllErrStatus '[] = () | |
AllErrStatus (a ': as) = (ErrStatus a, AllErrStatus as) |
>>>
:set -XDataKinds
>>>
:set -XTypeOperators