Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- servantDefs :: forall {k} (api :: k). Elmable api => Proxy api -> Set Definition
- class Elmable (e :: k) where
- endpoints :: [Param] -> Definitions ()
- class IsParam (a :: k) where
- data Param
- data PathParam
- data HeaderParam
- data QP
Generating Elm Clients
servantDefs :: forall {k} (api :: k). Elmable api => Proxy api -> Set Definition Source #
This function will traverse the api
type, generating elm definitions for:
* Http requests for each endpoint, including encoders and decoders for
anonymous elm types.
* Named Elm types (i.e. Any Specification
that is bound to a name using
JsonLet
* Decoders and Encoders for named elm types.
Extensions
The symbols in this section are mainly exposed in case you are using
some extensions to the standard servant types and need to build some
companion extensions to generate proper Elm types for them. For most
normal usage you will probably just use servantDefs
.
class Elmable (e :: k) where Source #
Class of servant APIs for which Elm client code can be generated.
endpoints :: [Param] -> Definitions () Source #
Collect all the Elm definitions needed to implement a client for
the API. This is called recursively on our walk down the API tree,
and the [
argument contains all the request parameters
(like Param
]Capture
, ReqBody'
, etc) that have been encountered so far on
whatever particular branch . It will start out empty at the API root.
Instances
class IsParam (a :: k) where Source #
Obtain a value-level request parameter type from the type-level servant parameter type.
param :: Definitions Param Source #
Instances
data HeaderParam Source #
Instances
Eq HeaderParam Source # | |
Defined in Data.JsonSpec.Elm.Servant (==) :: HeaderParam -> HeaderParam -> Bool # (/=) :: HeaderParam -> HeaderParam -> Bool # |