Safe Haskell | None |
---|---|
Language | Haskell2010 |
Serv.Server
- data Server m
- transformServer :: (forall x. m x -> n x) -> Server m -> Server n
- makeApplication :: Config -> Server IO -> Application
- data Config
- defaultConfig :: Config
- class Handling spec where
- data a :<|> b = a :<|> b
- data NotHere = NotHere
- noOp :: Applicative m => m NotHere
- data Response headers body
- emptyResponse :: Status -> Response '[] Empty
- withBody :: a -> Response headers Empty -> Response headers (Body ctypes a)
- withHeader :: Proxy name -> value -> Response headers body -> Response ((name ::: value) ': headers) body
- withQuietHeader :: HeaderEncode name value => Proxy name -> value -> Response headers body -> Response headers body
- module Network.HTTP.Types.Status
- module Data.Tagged
Documentation
transformServer :: (forall x. m x -> n x) -> Server m -> Server n Source #
makeApplication :: Config -> Server IO -> Application Source #
Build a Application
from an implemented
.Server
IO
class Handling spec where Source #
The the core type function responsible for interpreting an Api
into a
functioning Server
. It defines a function handle
defined over all forms
of Api
types which consumes a parallel type defined by the associated
type family Impl
. If api :: Api
then Impl api m
is an "implementation"
of the Api'
s server logic executing in the m
monad. Then, applying
handle
to a value of
results in a Impl
apiServer
which can be
executed as a Application
.
Minimal complete definition
Instances
Handling [k] ([] k) Source # | |
Handling (Api star) (Raw star) Source # | |
(VerbsOf [Method *] methods, HeadersReturnedBy methods, HeadersExpectedOf methods, Handling [Method *] methods) => Handling (Api *) (Endpoint * methods) Source # | |
Handling [Api star] apis => Handling (Api star) (OneOf star apis) Source # | |
(Handling a x, Handling [a] xs) => Handling [a] ((:) a x xs) Source # | |
Handling (Method *) method => Handling (Method *) (CaptureHeaders * headers method) Source # | |
Handling (Method *) method => Handling (Method *) (CaptureQuery * query method) Source # | |
(URIDecode v, Handling (Api *) api) => Handling (Api *) ((:>) * (Seg * n v) api) Source # | |
(HeaderDecode n v, Handling (Api *) api) => Handling (Api *) ((:>) * (Header * n v) api) Source # | |
(Handling (Api *) api, CorsPolicy p) => Handling (Api *) ((:>) * (Cors * p) api) Source # | |
(ReflectName n, KnownSymbol v, Handling (Api star) api) => Handling (Api star) ((:>) star (HeaderAs star n v) api) Source # | |
Handling (Api star) api => Handling (Api star) ((:>) star (Wildcard star) api) Source # | |
(KnownSymbol s, Handling (Api star) api) => Handling (Api star) ((:>) star (Const star s) api) Source # | |
(ReflectVerb verb, WaiResponse headers body) => Handling (Method *) (Method * verb headers body) Source # | |
WaiResponse headers body => Handling (Method *) (Method * GET headers body) Source # |
|
Handling (Method *) method => Handling (Method *) (CaptureBody * ctypes value method) Source # | |
data a :<|> b infixr 5 Source #
Either one thing or the other. In particular, often this is used when we are
describing either one server implementation or the other. Used to give
semantics to 'OneOf
and 'Endpoint
.
Constructors
a :<|> b infixr 5 |
A server implementation which always results in a "Not Found" error. Used to
give semantics to "pathological" servers like 'OneOf '[]
and Endpoint '[]
.
These servers could be statically disallowed but (1) they have a semantic sense as described by this type exactly and (2) to do so would require the creation and management of either larger types or non-empty proofs which would be burdensome to carry about.
Constructors
NotHere |
noOp :: Applicative m => m NotHere Source #
Actual servers are implemented effectfully; this is a no-op server which immediately returns Not Found and applies no effects.
withBody :: a -> Response headers Empty -> Response headers (Body ctypes a) Source #
Adds a body to a response
withHeader :: Proxy name -> value -> Response headers body -> Response ((name ::: value) ': headers) body Source #
Adds a header to a response
withQuietHeader :: HeaderEncode name value => Proxy name -> value -> Response headers body -> Response headers body Source #
Unlike withHeader
, withQuietHeader
allows you to add headers
not explicitly specified in the api specification.
module Network.HTTP.Types.Status
module Data.Tagged