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 ...
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 Client * ((:>) * * NoThrow ((:<|>) api1 api2)) # | |
type Client * ((:>) * * NoThrow ((:>) k k1 api apis)) # | |
type Client * ((:>) * * NoThrow (Verb * k1 method status ctypes a)) # | |
type ServerT * ((:>) * * NoThrow ((:<|>) api1 api2)) m # | |
type ServerT * ((:>) * * NoThrow ((:>) k k1 api apis)) m # | |
type ServerT * ((:>) * * NoThrow (Verb * k1 method status ctypes a)) m # | |
This is used internally and should not be used by end-users.
type Client * ((:>) * * (Throwing es) ((:>) k k1 api apis)) # | |
type Client * ((:>) * * (Throwing es) ((:<|>) api1 api2)) # | |
type Client * ((:>) * * (Throwing es) (Verb * k1 method status ctypes a)) # | |
type ServerT * ((:>) * * (Throwing es) ((:>) k k1 api apis)) m # | |
type ServerT * ((:>) * * (Throwing es) ((:<|>) api1 api2)) m # | |
type ServerT * ((:>) * * (Throwing es) (Verb * k1 method status ctypes a)) m # | |