HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleservant-0.20.2Haskell2010

Servant.API.QueryParam

  • 4 types
  • Packageservant-0.20.2
  • Exports4
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceQueryParam.hs
datadata QueryFlag (sym :: Symbol)
#

Lookup a potentially value-less query string parameter with boolean semantics. If the param sym is there without any value, or if it's there with value "true" or "1", it's interpreted as True. Otherwise, it's interpreted as False.

Example:

Example2 expressions
-- /books?publishedtype MyApi = "books" :> QueryFlag "published" :> Get '[JSON] [Book]
Instances2HasLink, MkLink

Lookup the value associated to the sym query string parameter and try to extract it as a value of type a.

Example:

Example2 expressions
-- /books?author=<author name>type MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book]
datadata QueryParams (sym :: Symbol) a
#

Lookup the values associated to the sym query string parameter and try to extract it as a value of type [a]. This is typically meant to support query string parameters of the form param[]=val1&param[]=val2 and so on. Note that servant doesn't actually require the []s and will fetch the values just fine with param=val1&param=val2, too.

Example:

Example2 expressions
-- /books?authors[]=<author1>&authors[]=<author2>&...type MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book]
Instances2HasLink, MkLink