docs(generic): Improve the documentation for genericServerT

This commit adds an explanation and a link to the Servant Cookbook
to `genericServerT`.

Moreover, the `genericServer` and `genericServe`'s haddocks are
slightly edited to add a missing 'a'.
This commit is contained in:
Théophile Choutri 2020-03-04 15:53:37 +01:00
parent 5998429e81
commit b3b3dc9f41

View file

@ -31,7 +31,7 @@ instance GenericMode (AsServerT m) where
type AsServer = AsServerT Handler type AsServer = AsServerT Handler
-- | Transform record of routes into a WAI 'Application'. -- | Transform a record of routes into a WAI 'Application'.
genericServe genericServe
:: forall routes. :: forall routes.
( HasServer (ToServantApi routes) '[] ( HasServer (ToServantApi routes) '[]
@ -80,13 +80,17 @@ genericServeTWithContext f server ctx =
p = genericApi (Proxy :: Proxy routes) p = genericApi (Proxy :: Proxy routes)
pctx = Proxy :: Proxy ctx pctx = Proxy :: Proxy ctx
-- | Transform record of endpoints into a 'Server'. -- | Transform a record of endpoints into a 'Server'.
genericServer genericServer
:: GenericServant routes AsServer :: GenericServant routes AsServer
=> routes AsServer => routes AsServer
-> ToServant routes AsServer -> ToServant routes AsServer
genericServer = toServant genericServer = toServant
-- | Transform a record of endpoints into a @'ServerT' m@.
--
-- You can see an example usage of this function
-- <https://docs.servant.dev/en/stable/cookbook/generic/Generic.html#using-generics-together-with-a-custom-monad in the Servant Cookbook>.
genericServerT genericServerT
:: GenericServant routes (AsServerT m) :: GenericServant routes (AsServerT m)
=> routes (AsServerT m) => routes (AsServerT m)