Skip to content

Commit b8f4531

Browse files
jkarnisoenkehahn
authored andcommitted
Documentation for config.
1 parent 2445855 commit b8f4531

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

servant/src/Servant/API/WithNamedConfig.hs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,21 @@ module Servant.API.WithNamedConfig where
55

66
import GHC.TypeLits
77

8+
-- | 'WithNamedConfig' names a specific tagged configuration to use for the
9+
-- combinators in the API. For example:
10+
--
11+
-- > type UseNamedConfigAPI1 = WithNamedConfig "myConfig" '[String] (
12+
-- > ReqBody '[JSON] Int :> Get '[JSON] Int)
13+
--
14+
-- Both the 'ReqBody' and 'Get' combinators will use the 'NamedConfig' with
15+
-- type tag "myConfig" as their configuration. In constrast, in (notice
16+
-- parentesizing):
17+
--
18+
-- > type UseNamedConfigAPI2 = WithNamedConfig "myConfig" '[String] (
19+
-- > ReqBody '[JSON] Int) :> Get '[JSON] Int
20+
--
21+
-- Only the 'ReqBody' combinator will use this configuration, and 'Get' will
22+
-- maintain the default configuration.
23+
--
24+
-- For more information, see the tutorial.
825
data WithNamedConfig (name :: Symbol) (subConfig :: [*]) subApi

0 commit comments

Comments
 (0)