Documentation for config.
This commit is contained in:
parent
2445855203
commit
b8f453127b
1 changed files with 17 additions and 0 deletions
|
@ -5,4 +5,21 @@ module Servant.API.WithNamedConfig where
|
||||||
|
|
||||||
import GHC.TypeLits
|
import GHC.TypeLits
|
||||||
|
|
||||||
|
-- | 'WithNamedConfig' names a specific tagged configuration to use for the
|
||||||
|
-- combinators in the API. For example:
|
||||||
|
--
|
||||||
|
-- > type UseNamedConfigAPI1 = WithNamedConfig "myConfig" '[String] (
|
||||||
|
-- > ReqBody '[JSON] Int :> Get '[JSON] Int)
|
||||||
|
--
|
||||||
|
-- Both the 'ReqBody' and 'Get' combinators will use the 'NamedConfig' with
|
||||||
|
-- type tag "myConfig" as their configuration. In constrast, in (notice
|
||||||
|
-- parentesizing):
|
||||||
|
--
|
||||||
|
-- > type UseNamedConfigAPI2 = WithNamedConfig "myConfig" '[String] (
|
||||||
|
-- > ReqBody '[JSON] Int) :> Get '[JSON] Int
|
||||||
|
--
|
||||||
|
-- Only the 'ReqBody' combinator will use this configuration, and 'Get' will
|
||||||
|
-- maintain the default configuration.
|
||||||
|
--
|
||||||
|
-- For more information, see the tutorial.
|
||||||
data WithNamedConfig (name :: Symbol) (subConfig :: [*]) subApi
|
data WithNamedConfig (name :: Symbol) (subConfig :: [*]) subApi
|
||||||
|
|
Loading…
Reference in a new issue