<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><title>Servant.Utils.Links</title><linkhref="ocean.css"rel="stylesheet"type="text/css"title="Ocean"/><scriptsrc="haddock-util.js"type="text/javascript"></script><scripttype="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Servant-Utils-Links.html");};
</script></head><body><divid="package-header"><ulclass="links"id="page-menu"><li><ahref="src/Servant-Utils-Links.html">Source</a></li><li><ahref="index.html">Contents</a></li><li><ahref="doc-index.html">Index</a></li></ul><pclass="caption">servant-0.2: A family of combinators for defining webservices APIs and serving them</p></div><divid="content"><divid="module-header"><tableclass="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><pclass="caption">Servant.Utils.Links</p></div><divid="description"><pclass="caption">Description</p><divclass="doc"><p>Type safe internal links.</p><p>Provides the function <code><ahref="Servant-Utils-Links.html#v:mkLink">mkLink</a></code>:</p><pre> type API = Proxy ("hello" :> Get Int
:<ahref="|">|</a>"bye" :> QueryParam "name" String :> Post Bool)
api :: API
api = proxy
link1 :: Proxy ("hello" :> Get Int)
link1 = proxy
link2 :: Proxy ("hello" :> Delete)
link2 = proxy
mkLink link1 API -- typechecks, returns 'Link "/hello"'
mkLink link2 API -- doesn't typecheck
</pre><p>That is, <code><ahref="Servant-Utils-Links.html#v:mkLink">mkLink</a></code> takes two arguments, a link proxy and a sitemap, and
returns a <code><ahref="Servant-Utils-Links.html#t:Link">Link</a></code>, but only typechecks if the link proxy is a valid link,
and part of the sitemap.</p><p><strong>N.B.:</strong><code><ahref="Servant-Utils-Links.html#v:mkLink">mkLink</a></code> assumes a capture matches any string (without slashes).</p></div></div><divid="synopsis"><pid="control.syn"class="caption expander"onclick="toggleSection('syn')">Synopsis</p><ulid="section.syn"class="hide"onclick="toggleSection('syn')"><liclass="src short"><spanclass="keyword">type family</span><ahref="#t:Or">Or</a> a b</li><liclass="src short"><spanclass="keyword">type family</span><ahref="#t:And">And</a> a b</li><liclass="src short"><spanclass="keyword">type family</span><ahref="#t:IsElem">IsElem</a> a s</li><liclass="src short"><spanclass="keyword">type family</span><ahref="#t:IsLink-39--39-">IsLink''</a> l</li><liclass="src short"><spanclass="keyword">type family</span><ahref="#t:IsLink-39-">IsLink'</a> e</li><liclass="src short"><spanclass="keyword">type family</span><ahref="#t:IsLink">IsLink</a> e</li><liclass="src short"><spanclass="keyword">class</span><ahref="#t:ValidLinkIn">ValidLinkIn</a> f s <spanclass="keyword">where</span><ulclass="subs"><li><ahref="#v:mkLink">mkLink</a> :: f -> s -><ahref="Servant-Utils-Links.html#t:Link">Link</a></li></ul></li><liclass="src short"><spanclass="keyword">data</span><ahref="#t:Link">Link</a> = <ahref="#v:Link">Link</a><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-String.html#t:String">String</a></li><liclass="src short"><spanclass="keyword">class</span><ahref="#t:VLinkHelper">VLinkHelper</a> f <spanclass="keyword">where</span><ulclass="subs"><li><ahref="#v:vlh">vlh</a> :: <spanclass="keyword">forall</span> proxy. proxy f -><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-String.html#t:String">String</a></li></ul></li></ul></div><divid="interface"><h1>Documentation</h1><divclass="top"><pclass="src"><spanclass="keyword">type family</span><aname="t:Or"class="def">Or</a> a b <ahref="src/Servant-Utils-Links.html#Or"class="link">Source</a></p><divclass="subs equations"><pclass="caption">Equations</p><table><tr><tdclass="src"><ahref="Servant-Utils-Links.html#t:Or">Or</a><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:False">False</a><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:False">False</a> = <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:False">False</a></td><tdclass="doc empty"> </td></tr><tr><tdclass="src"><ahref="Servant-Utils-Links.html#t:Or">Or</a><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:True">True</a> b = <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:True">True</a></td><tdclass="doc empty"> </td></tr><tr><tdclass="src"><ahref="Servant-Utils-Links.html#t:Or">Or</a> a <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:True">True</a> = <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:True">True</a></td><tdclass="doc empty"> </td></tr></table></div></div><divclass="top"><pclass="src"><spanclass="keyword">type family</span><aname="t:And"class="def">And</a> a b <ahref="src/Servant-Utils-Links.html#And"class="link">Source</a></p><divclass="subs equations"><pclass="caption">Equations</p><table><tr><tdclass="src"><ahref="Servant-Utils-Links.html#t:And">And</a><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:True">True</a><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:True">True</a> = <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:True">True</a></td><tdclass="doc empty"> </td></tr><tr><tdclass="src"><ahref="Servant-Utils-Links.html#t:And">And</a> a <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:False">False</a> = <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:False">False</a></td><tdclass="doc empty"> </t
contains <code>f</code>, and <code>f</code> is a link.</p></div><divclass="subs methods"><pclass="caption">Methods</p><pclass="src"><aname="v:mkLink"class="def">mkLink</a><ahref="src/Servant-Utils-Links.html#mkLink"class="link">Source</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: f</td><tdclass="doc empty"> </td></tr><tr><tdclass="src">-> s</td><tdclass="doc empty"> </td></tr><tr><tdclass="src">-><ahref="Servant-Utils-Links.html#t:Link">Link</a></td><tdclass="doc"><p>This function will only typecheck if <code>f</code>
is an URI within <code>s</code></p></td></tr></table></div></div><divclass="subs instances"><pid="control.i:ValidLinkIn"class="caption collapser"onclick="toggleSection('i:ValidLinkIn')">Instances</p><divid="section.i:ValidLinkIn"class="show"><table><tr><tdclass="src">((~) <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#t:Bool">Bool</a> (<ahref="Servant-Utils-Links.html#t:IsElem">IsElem</a> f s) <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:True">True</a>, (~) <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#t:Bool">Bool</a> (<ahref="Servant-Utils-Links.html#t:IsLink">IsLink</a> f) <ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#v:True">True</a>, <ahref="Servant-Utils-Links.html#t:VLinkHelper">VLinkHelper</a> * f) =><ahref="Servant-Utils-Links.html#t:ValidLinkIn">ValidLinkIn</a> f s</td><tdclass="doc empty"> </td></tr></table></div></div></div><divclass="top"><pclass="src"><spanclass="keyword">data</span><aname="t:Link"class="def">Link</a><ahref="src/Servant-Utils-Links.html#Link"class="link">Source</a></p><divclass="subs constructors"><pclass="caption">Constructors</p><table><tr><tdclass="src"><aname="v:Link"class="def">Link</a><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-String.html#t:String">String</a></td><tdclass="doc empty"> </td></tr></table></div><divclass="subs instances"><pid="control.i:Link"class="caption collapser"onclick="toggleSection('i:Link')">Instances</p><divid="section.i:Link"class="show"><table><tr><tdclass="src"><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Text-Show.html#t:Show">Show</a><ahref="Servant-Utils-Links.html#t:Link">Link</a></td><tdclass="doc empty"> </td></tr></table></div></div></div><divclass="top"><pclass="src"><spanclass="keyword">class</span><aname="t:VLinkHelper"class="def">VLinkHelper</a> f <spanclass="keyword">where</span><ahref="src/Servant-Utils-Links.html#VLinkHelper"class="link">Source</a></p><divclass="subs methods"><pclass="caption">Methods</p><pclass="src"><aname="v:vlh"class="def">vlh</a> :: <spanclass="keyword">forall</span> proxy. proxy f -><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-String.html#t:String">String</a><ahref="src/Servant-Utils-Links.html#vlh"class="link">Source</a></p></div><divclass="subs instances"><pid="control.i:VLinkHelper"class="caption collapser"onclick="toggleSection('i:VLinkHelper')">Instances</p><divid="section.i:VLinkHelper"class="show"><table><tr><tdclass="src"><ahref="Servant-Utils-Links.html#t:VLinkHelper">VLinkHelper</a> * (<ahref="Servant-API-Get.html#t:Get">Get</a> x)</td><tdclass="doc empty"> </td></tr><tr><tdclass="src"><ahref="Servant-Utils-Links.html#t:VLinkHelper">VLinkHelper</a> * (<ahref="Servant-API-Post.html#t:Post">Post</a> x)</td><tdclass="doc empty"> </td></tr><tr><tdclass="src">(<ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:KnownSymbol">KnownSymbol</a> s, <ahref="Servant-Utils-Links.html#t:VLinkHelper">VLinkHelper</a> * e) =><ahref="Servant-Utils-Links.html#t:VLinkHelper">VLinkHelper</a> * (<ahref="Servant-API-Sub.html#t::-62-">(:>)</a><ahref="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> s e)</td><tdclass="doc empty"> </td></tr></table></div></div></div></div></div><divid="footer"><p>Produced by <ahref="http://www.haskell.org/haddock/">Haddock</a> version 2.15.0</p></div></body></html>