servant/Servant-Utils-Links.html

23 lines
16 KiB
HTML
Raw Permalink Normal View History

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