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-lucid-0.9.0.6Haskell2010

Lucid.Servant

Some helper functions for creating values in lucid DSLs that work with servant.

  • 6 values
valuesafeHref_
  1. :: (IsElem endpoint api, HasLink endpoint)
  2. => Text
  3. -> Proxy api
  4. -> Proxy endpoint
  5. -> MkLink endpoint Attribute
#

safeLink variant which creates lucid's Attribute given base url.

Example2 expressions
type API = "path" :> Get '[JSON] Intlet api = Proxy :: Proxy API
Example1 expression
safeHref_ "" api apiAttribute "href" "path"
Example1 expression
safeHref_ "/" api apiAttribute "href" "/path"
Example1 expression
safeHref_ "http://example.com" api apiAttribute "href" "http://example.com/path"
Example1 expression
safeHref_ "http://example.com/" api apiAttribute "href" "http://example.com/path"
valuelinkHref_ :: Text -> Link -> Attribute
#

Create an href attribute from a Link, with given base url.

"servant" ensures that any Link is valid within an API. This function ensures it is possible to navigate to that endpoint from a page which shares a root with that API.

valuelinkAbsHref_ :: Link -> Attribute
#

Create an href attribute from a Link, with leading /.

"servant" ensures that any Link is valid within an API. This function ensures it is possible to navigate to that endpoint from a page which shares a root with that API.

valuelinkRelHref_ :: Link -> Attribute
#

Create an href attribute from a Link, as a relative link.

"servant" ensures that any Link is valid within an API. Use this function if a relative link (no leading /) is required.