HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

Moduleservant-0.20.3.0Haskell2010

Servant.API.WithNamedContext

  • 1 type
  • Packageservant-0.20.3.0
  • Exports1
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceWithNamedContext.hs
datadata WithNamedContext (name :: Symbol) (subContext :: [Type]) (subApi :: k)
#

WithNamedContext names a specific tagged context to use for the combinators in the API. (See also in servant-server, Servant.Server.Context.) For example:

type UseNamedContextAPI = WithNamedContext "myContext" '[String] (
    ReqBody '[JSON] Int :> Get '[JSON] Int)

Both the ReqBody and Get combinators will use the WithNamedContext with type tag "myContext" as their context.

Contexts are only relevant for servant-server.

For more information, see the tutorial.

Instances2HasLink, MkLink