HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleservant-0.20.2Haskell2010

Servant.API.WithNamedContext

  • 1 type
  • Packageservant-0.20.2
  • 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