API package:servant
A type that specifies that an API record contains an API definition.
Only useful at type-level.
Parse value from HTTP API data.
WARNING: Do not derive this using DeriveAnyClass as
the generated instance will loop indefinitely.
Convert value to HTTP API data.
WARNING: Do not derive this using DeriveAnyClass as
the generated instance will loop indefinitely.
Get a
Proxy of an API type.
An empty API: one which serves nothing. Morally speaking, this should
be the unit of
:<|>. Implementors of interpretations of
API types should treat
EmptyAPI as close to the unit as
possible.
Check whether
sub is a sub-API of
api.
>>> ok (Proxy :: Proxy (IsSubAPI SampleAPI (SampleAPI :<|> Get '[JSON] Int)))
OK
>>> ok (Proxy :: Proxy (IsSubAPI (SampleAPI :<|> Get '[JSON] Int) SampleAPI))
...
... Could not ...
...
This uses
IsElem for checking; thus the note there applies
here.
This is a module containing an API with all
API combinators. It
is used for testing only (in particular, checking that instances exist
for the core servant classes for each combinator).