HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleservant-lucid-0.9.0.6Haskell2010

Lucid.Servant

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

Synopsis
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.

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.

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.