-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Servant support for lucid
--   
--   Servant support for lucid.
--   
--   <a>HTML</a> content type which will use <a>ToHtml</a> class.
--   
--   Lucid.Servant uses <a>Link</a> rather than <a>Text</a> for safe
--   <a>href</a> attributes.
@package servant-lucid
@version 0.8.1


-- | Some helper functions for creating values in <a>lucid</a> DSLs that
--   work with <a>servant</a>.
module Lucid.Servant

-- | <tt>safeLink</tt> variant which creates lucid's <a>Attribute</a> given
--   base url.
--   
--   <pre>
--   &gt;&gt;&gt; type API = "path" :&gt; Get '[JSON] Int
--   
--   &gt;&gt;&gt; let api = Proxy :: Proxy API
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; safeHref_ "" api api
--   Attribute "href" "path"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; safeHref_ "/" api api
--   Attribute "href" "/path"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; safeHref_ "http://example.com" api api
--   Attribute "href" "http://example.com/path"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; safeHref_ "http://example.com/" api api
--   Attribute "href" "http://example.com/path"
--   </pre>
safeHref_ :: (IsElem endpoint api, HasLink endpoint) => Text -> Proxy api -> Proxy endpoint -> MkLink endpoint Attribute

-- | <pre>
--   <tt>safeLink</tt> "/"
--   </pre>
safeAbsHref_ :: (IsElem endpoint api, HasLink endpoint) => Proxy api -> Proxy endpoint -> MkLink endpoint Attribute

-- | <pre>
--   <tt>safeLink</tt> ""
--   </pre>
safeRelHref_ :: (IsElem endpoint api, HasLink endpoint) => Proxy api -> Proxy endpoint -> MkLink endpoint Attribute

-- | Create an <tt>href</tt> attribute from a <a>Link</a>, with given base
--   url.
--   
--   "servant" ensures that any <a>Link</a> 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.
linkHref_ :: Text -> Link -> Attribute

-- | Create an <tt>href</tt> attribute from a <a>Link</a>, with leading
--   <a>/</a>.
--   
--   "servant" ensures that any <a>Link</a> 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.
linkAbsHref_ :: Link -> Attribute

-- | Create an <tt>href</tt> attribute from a <a>Link</a>, as a relative
--   link.
--   
--   "servant" ensures that any <a>Link</a> is valid within an API. Use
--   this function if a relative link (no leading <a>/</a>) is required.
linkRelHref_ :: Link -> Attribute


-- | An <tt>HTML</tt> empty data type with <a>MimeRender</a> instances for
--   <tt>lucid</tt>'s <a>ToHtml</a> class and <tt>Html</tt> datatype. You
--   should only need to import this module for it's instances and the
--   <a>HTML</a> datatype.:
--   
--   <pre>
--   &gt;&gt;&gt; type Eg = Get '[HTML] a
--   </pre>
--   
--   Will then check that <tt>a</tt> has a <a>ToHtml</a> instance, or is
--   <tt>Html</tt>.
module Servant.HTML.Lucid
data HTML
instance Servant.API.ContentTypes.Accept Servant.HTML.Lucid.HTML
instance Lucid.Base.ToHtml a => Servant.API.ContentTypes.MimeRender Servant.HTML.Lucid.HTML a
