This file is indexed.

/usr/share/doc/libghc-servant-server-doc/html/Servant-Server-Internal-RoutingApplication.html is in libghc-servant-server-doc 0.8.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!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.Server.Internal.RoutingApplication</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Servant-Server-Internal-RoutingApplication.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Servant-Server-Internal-RoutingApplication.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-server-0.8.1: 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.Server.Internal.RoutingApplication</p></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</span> <a href="#t:RoutingApplication">RoutingApplication</a> = <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:ResponseReceived">ResponseReceived</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:ResponseReceived">ResponseReceived</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:RouteResult">RouteResult</a> a<ul class="subs"><li>= <a href="#v:Fail">Fail</a> <a href="Servant-Server-Internal-ServantErr.html#t:ServantErr">ServantErr</a></li><li>| <a href="#v:FailFatal">FailFatal</a> !<a href="Servant-Server-Internal-ServantErr.html#t:ServantErr">ServantErr</a></li><li>| <a href="#v:Route">Route</a> !a</li></ul></li><li class="src short"><a href="#v:toApplication">toApplication</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:RoutingApplication">RoutingApplication</a> -&gt; <a href="Servant-Server.html#t:Application">Application</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:Delayed">Delayed</a> env c <span class="keyword">where</span><ul class="subs"><li><a href="#v:Delayed">Delayed</a> :: {..} -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env c</li></ul></li><li class="src short"><span class="keyword">newtype</span> <a href="#t:DelayedIO">DelayedIO</a> a = <a href="#v:DelayedIO">DelayedIO</a> {<ul class="subs"><li><a href="#v:runDelayedIO">runDelayedIO</a> :: <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a)</li></ul>}</li><li class="src short"><a href="#v:emptyDelayed">emptyDelayed</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a</li><li class="src short"><a href="#v:delayedFail">delayedFail</a> :: <a href="Servant-Server-Internal-ServantErr.html#t:ServantErr">ServantErr</a> -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a</li><li class="src short"><a href="#v:delayedFailFatal">delayedFailFatal</a> :: <a href="Servant-Server-Internal-ServantErr.html#t:ServantErr">ServantErr</a> -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a</li><li class="src short"><a href="#v:withRequest">withRequest</a> :: (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a</li><li class="src short"><a href="#v:addCapture">addCapture</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env (a -&gt; b) -&gt; (captured -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> (captured, env) b</li><li class="src short"><a href="#v:addMethodCheck">addMethodCheck</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> () -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a</li><li class="src short"><a href="#v:addAuthCheck">addAuthCheck</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env (a -&gt; b) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env b</li><li class="src short"><a href="#v:addBodyCheck">addBodyCheck</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env (a -&gt; b) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env b</li><li class="src short"><a href="#v:addAcceptCheck">addAcceptCheck</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> () -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a</li><li class="src short"><a href="#v:passToServer">passToServer</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env (a -&gt; b) -&gt; (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; a) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env b</li><li class="src short"><a href="#v:runDelayed">runDelayed</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a -&gt; env -&gt; <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a)</li><li class="src short"><a href="#v:runAction">runAction</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env (<a href="Servant-Server-Internal-ServantErr.html#t:Handler">Handler</a> a) -&gt; env -&gt; <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> r) -&gt; (a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> r</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:RoutingApplication" class="def">RoutingApplication</a> <a href="src/Servant-Server-Internal-RoutingApplication.html#RoutingApplication" class="link">Source</a> <a href="#t:RoutingApplication" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">&nbsp;= <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a></td><td class="doc"><p>the request, the field <code>pathInfo</code> may be modified by url routing</p></td></tr><tr><td class="src">-&gt; (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:ResponseReceived">ResponseReceived</a>)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:ResponseReceived">ResponseReceived</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:RouteResult" class="def">RouteResult</a> a <a href="src/Servant-Server-Internal-RoutingApplication.html#RouteResult" class="link">Source</a> <a href="#t:RouteResult" class="selflink">#</a></p><div class="doc"><p>The result of matching against a path in the route tree.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:Fail" class="def">Fail</a> <a href="Servant-Server-Internal-ServantErr.html#t:ServantErr">ServantErr</a></td><td class="doc"><p>Keep trying other paths. The <code>ServantErr</code>
 should only be 404, 405 or 406.</p></td></tr><tr><td class="src"><a id="v:FailFatal" class="def">FailFatal</a> !<a href="Servant-Server-Internal-ServantErr.html#t:ServantErr">ServantErr</a></td><td class="doc"><p>Don't try other paths.</p></td></tr><tr><td class="src"><a id="v:Route" class="def">Route</a> !a</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:RouteResult" class="caption collapser" onclick="toggleSection('i:RouteResult')">Instances</p><div id="section.i:RouteResult" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:RouteResult:Functor:1" class="instance expander" onclick="toggleSection('i:id:RouteResult:Functor:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Functor.html#t:Functor">Functor</a> <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a></span> <a href="src/Servant-Server-Internal-RoutingApplication.html#line-30" class="link">Source</a> <a href="#t:RouteResult" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:RouteResult:Functor:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fmap">fmap</a> :: (a -&gt; b) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> b <a href="#v:fmap" class="selflink">#</a></p><p class="src"><a href="#v:-60--36-">(&lt;$)</a> :: a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> b -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a <a href="#v:-60--36-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:RouteResult:Eq:2" class="instance expander" onclick="toggleSection('i:id:RouteResult:Eq:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a)</span> <a href="src/Servant-Server-Internal-RoutingApplication.html#line-30" class="link">Source</a> <a href="#t:RouteResult" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:RouteResult:Eq:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:RouteResult:Read:3" class="instance expander" onclick="toggleSection('i:id:RouteResult:Read:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Read.html#t:Read">Read</a> a =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Read.html#t:Read">Read</a> (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a)</span> <a href="src/Servant-Server-Internal-RoutingApplication.html#line-30" class="link">Source</a> <a href="#t:RouteResult" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:RouteResult:Read:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:readsPrec">readsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a) <a href="#v:readsPrec" class="selflink">#</a></p><p class="src"><a href="#v:readList">readList</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> [<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a] <a href="#v:readList" class="selflink">#</a></p><p class="src"><a href="#v:readPrec">readPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a) <a href="#v:readPrec" class="selflink">#</a></p><p class="src"><a href="#v:readListPrec">readListPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> [<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a] <a href="#v:readListPrec" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:RouteResult:Show:4" class="instance expander" onclick="toggleSection('i:id:RouteResult:Show:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:Show">Show</a> a =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:Show">Show</a> (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a)</span> <a href="src/Servant-Server-Internal-RoutingApplication.html#line-30" class="link">Source</a> <a href="#t:RouteResult" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:RouteResult:Show:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:toApplication" class="def">toApplication</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:RoutingApplication">RoutingApplication</a> -&gt; <a href="Servant-Server.html#t:Application">Application</a> <a href="src/Servant-Server-Internal-RoutingApplication.html#toApplication" class="link">Source</a> <a href="#v:toApplication" class="selflink">#</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Delayed" class="def">Delayed</a> env c <span class="keyword">where</span> <a href="src/Servant-Server-Internal-RoutingApplication.html#Delayed" class="link">Source</a> <a href="#t:Delayed" class="selflink">#</a></p><div class="doc"><p>A <code><a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a></code> is a representation of a handler with scheduled
 delayed checks that can trigger errors.</p><p>Why would we want to delay checks?</p><p>There are two reasons:</p><ol><li>In a straight-forward implementation, the order in which we
 perform checks will determine the error we generate. This is
 because once an error occurs, we would abort and not perform
 any subsequent checks, but rather return the current error.</li></ol><p>This is not a necessity: we could continue doing other checks,
 and choose the preferred error. However, that would in general
 mean more checking, which leads us to the other reason.</p><ol><li>We really want to avoid doing certain checks too early. For
 example, captures involve parsing, and are much more costly
 than static route matches. In particular, if several paths
 contain the &quot;same&quot; capture, we'd like as much as possible to
 avoid trying the same parse many times. Also tricky is the
 request body. Again, this involves parsing, but also, WAI makes
 obtaining the request body a side-effecting operation. We
 could/can work around this by manually caching the request body,
 but we'd rather keep the number of times we actually try to
 decode the request body to an absolute minimum.</li></ol><p>We prefer to have the following relative priorities of error
 codes:</p><pre>404
405 (bad method)
401 (unauthorized)
415 (unsupported media type)
400 (bad request)
406 (not acceptable)
</pre><p>Therefore, while routing, we delay most checks so that they
 will ultimately occur in the right order.</p><p>A <code><a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a></code> contains three delayed blocks of tests, and
 the actual handler:</p><ol><li>Delayed captures. These can actually cause 404, and
 while they're costly, they should be done first among the
 delayed checks (at least as long as we do not decouple the
 check order from the error reporting, see above). Delayed
 captures can provide inputs to the actual handler.</li><li>Method check(s). This can cause a 405. On success,
 it does not provide an input for the handler. Method checks
 are comparatively cheap.</li><li>Body and accept header checks. The request body check can
 cause both 400 and 415. This provides an input to the handler.
 The accept header check can be performed as the final
 computation in this block. It can cause a 406.</li></ol></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:Delayed" class="def">Delayed</a> :: {..} -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env c</td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><ul><li><dfn class="src"><a id="v:capturesD" class="def">capturesD</a> :: env -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> captures</dfn><div class="doc empty">&nbsp;</div></li><li><dfn class="src"><a id="v:methodD" class="def">methodD</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> ()</dfn><div class="doc empty">&nbsp;</div></li><li><dfn class="src"><a id="v:authD" class="def">authD</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> auth</dfn><div class="doc empty">&nbsp;</div></li><li><dfn class="src"><a id="v:bodyD" class="def">bodyD</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> body</dfn><div class="doc empty">&nbsp;</div></li><li><dfn class="src"><a id="v:serverD" class="def">serverD</a> :: captures -&gt; auth -&gt; body -&gt; <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> c</dfn><div class="doc empty">&nbsp;</div></li></ul></div></td></tr></table></div><div class="subs instances"><p id="control.i:Delayed" class="caption collapser" onclick="toggleSection('i:Delayed')">Instances</p><div id="section.i:Delayed" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Delayed:Functor:1" class="instance expander" onclick="toggleSection('i:id:Delayed:Functor:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Functor.html#t:Functor">Functor</a> (<a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env)</span> <a href="src/Servant-Server-Internal-RoutingApplication.html#line-108" class="link">Source</a> <a href="#t:Delayed" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Delayed:Functor:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fmap">fmap</a> :: (a -&gt; b) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env b <a href="#v:fmap" class="selflink">#</a></p><p class="src"><a href="#v:-60--36-">(&lt;$)</a> :: a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env b -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a <a href="#v:-60--36-" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">newtype</span> <a id="t:DelayedIO" class="def">DelayedIO</a> a <a href="src/Servant-Server-Internal-RoutingApplication.html#DelayedIO" class="link">Source</a> <a href="#t:DelayedIO" class="selflink">#</a></p><div class="doc"><p>Computations used in a <code><a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a></code> can depend on the
 incoming <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a></code>, may perform 'IO, and result in a
 'RouteResult, meaning they can either suceed, fail
 (with the possibility to recover), or fail fatally.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:DelayedIO" class="def">DelayedIO</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><ul><li><dfn class="src"><a id="v:runDelayedIO" class="def">runDelayedIO</a> :: <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a)</dfn><div class="doc empty">&nbsp;</div></li></ul></div></td></tr></table></div><div class="subs instances"><p id="control.i:DelayedIO" class="caption collapser" onclick="toggleSection('i:DelayedIO')">Instances</p><div id="section.i:DelayedIO" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:DelayedIO:Monad:1" class="instance expander" onclick="toggleSection('i:id:DelayedIO:Monad:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad.html#t:Monad">Monad</a> <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a></span> <a href="src/Servant-Server-Internal-RoutingApplication.html#line-129" class="link">Source</a> <a href="#t:DelayedIO" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:DelayedIO:Monad:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-62--62--61-">(&gt;&gt;=)</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a -&gt; (a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> b) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> b <a href="#v:-62--62--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62--62-">(&gt;&gt;)</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> b -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> b <a href="#v:-62--62-" class="selflink">#</a></p><p class="src"><a href="#v:return">return</a> :: a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a <a href="#v:return" class="selflink">#</a></p><p class="src"><a href="#v:fail">fail</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a <a href="#v:fail" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:DelayedIO:Functor:2" class="instance expander" onclick="toggleSection('i:id:DelayedIO:Functor:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Functor.html#t:Functor">Functor</a> <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a></span> <a href="src/Servant-Server-Internal-RoutingApplication.html#line-122" class="link">Source</a> <a href="#t:DelayedIO" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:DelayedIO:Functor:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fmap">fmap</a> :: (a -&gt; b) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> b <a href="#v:fmap" class="selflink">#</a></p><p class="src"><a href="#v:-60--36-">(&lt;$)</a> :: a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> b -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a <a href="#v:-60--36-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:DelayedIO:Applicative:3" class="instance expander" onclick="toggleSection('i:id:DelayedIO:Applicative:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Applicative.html#t:Applicative">Applicative</a> <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a></span> <a href="src/Servant-Server-Internal-RoutingApplication.html#line-125" class="link">Source</a> <a href="#t:DelayedIO" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:DelayedIO:Applicative:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:pure">pure</a> :: a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a <a href="#v:pure" class="selflink">#</a></p><p class="src"><a href="#v:-60--42--62-">(&lt;*&gt;)</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> (a -&gt; b) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> b <a href="#v:-60--42--62-" class="selflink">#</a></p><p class="src"><a href="#v:-42--62-">(*&gt;)</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> b -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> b <a href="#v:-42--62-" class="selflink">#</a></p><p class="src"><a href="#v:-60--42-">(&lt;*)</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> b -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a <a href="#v:-60--42-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:DelayedIO:MonadIO:4" class="instance expander" onclick="toggleSection('i:id:DelayedIO:MonadIO:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a></span> <a href="src/Servant-Server-Internal-RoutingApplication.html#line-139" class="link">Source</a> <a href="#t:DelayedIO" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:DelayedIO:MonadIO:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:liftIO">liftIO</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a <a href="#v:liftIO" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:emptyDelayed" class="def">emptyDelayed</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a <a href="src/Servant-Server-Internal-RoutingApplication.html#emptyDelayed" class="link">Source</a> <a href="#v:emptyDelayed" class="selflink">#</a></p><div class="doc"><p>A <code><a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a></code> without any stored checks.</p></div></div><div class="top"><p class="src"><a id="v:delayedFail" class="def">delayedFail</a> :: <a href="Servant-Server-Internal-ServantErr.html#t:ServantErr">ServantErr</a> -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a <a href="src/Servant-Server-Internal-RoutingApplication.html#delayedFail" class="link">Source</a> <a href="#v:delayedFail" class="selflink">#</a></p><div class="doc"><p>Fail with the option to recover.</p></div></div><div class="top"><p class="src"><a id="v:delayedFailFatal" class="def">delayedFailFatal</a> :: <a href="Servant-Server-Internal-ServantErr.html#t:ServantErr">ServantErr</a> -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a <a href="src/Servant-Server-Internal-RoutingApplication.html#delayedFailFatal" class="link">Source</a> <a href="#v:delayedFailFatal" class="selflink">#</a></p><div class="doc"><p>Fail fatally, i.e., without any option to recover.</p></div></div><div class="top"><p class="src"><a id="v:withRequest" class="def">withRequest</a> :: (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a <a href="src/Servant-Server-Internal-RoutingApplication.html#withRequest" class="link">Source</a> <a href="#v:withRequest" class="selflink">#</a></p><div class="doc"><p>Gain access to the incoming request.</p></div></div><div class="top"><p class="src"><a id="v:addCapture" class="def">addCapture</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env (a -&gt; b) -&gt; (captured -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> (captured, env) b <a href="src/Servant-Server-Internal-RoutingApplication.html#addCapture" class="link">Source</a> <a href="#v:addCapture" class="selflink">#</a></p><div class="doc"><p>Add a capture to the end of the capture block.</p></div></div><div class="top"><p class="src"><a id="v:addMethodCheck" class="def">addMethodCheck</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> () -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a <a href="src/Servant-Server-Internal-RoutingApplication.html#addMethodCheck" class="link">Source</a> <a href="#v:addMethodCheck" class="selflink">#</a></p><div class="doc"><p>Add a method check to the end of the method block.</p></div></div><div class="top"><p class="src"><a id="v:addAuthCheck" class="def">addAuthCheck</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env (a -&gt; b) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env b <a href="src/Servant-Server-Internal-RoutingApplication.html#addAuthCheck" class="link">Source</a> <a href="#v:addAuthCheck" class="selflink">#</a></p><div class="doc"><p>Add an auth check to the end of the auth block.</p></div></div><div class="top"><p class="src"><a id="v:addBodyCheck" class="def">addBodyCheck</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env (a -&gt; b) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env b <a href="src/Servant-Server-Internal-RoutingApplication.html#addBodyCheck" class="link">Source</a> <a href="#v:addBodyCheck" class="selflink">#</a></p><div class="doc"><p>Add a body check to the end of the body block.</p></div></div><div class="top"><p class="src"><a id="v:addAcceptCheck" class="def">addAcceptCheck</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:DelayedIO">DelayedIO</a> () -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a <a href="src/Servant-Server-Internal-RoutingApplication.html#addAcceptCheck" class="link">Source</a> <a href="#v:addAcceptCheck" class="selflink">#</a></p><div class="doc"><p>Add an accept header check to the beginning of the body
 block. There is a tradeoff here. In principle, we'd like
 to take a bad body (400) response take precedence over a
 failed accept check (406). BUT to allow streaming the body,
 we cannot run the body check and then still backtrack.
 We therefore do the accept check before the body check,
 when we can still backtrack. There are other solutions to
 this, but they'd be more complicated (such as delaying the
 body check further so that it can still be run in a situation
 where we'd otherwise report 406).</p></div></div><div class="top"><p class="src"><a id="v:passToServer" class="def">passToServer</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env (a -&gt; b) -&gt; (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; a) -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env b <a href="src/Servant-Server-Internal-RoutingApplication.html#passToServer" class="link">Source</a> <a href="#v:passToServer" class="selflink">#</a></p><div class="doc"><p>Many combinators extract information that is passed to
 the handler without the possibility of failure. In such a
 case, <code><a href="Servant-Server-Internal-RoutingApplication.html#v:passToServer">passToServer</a></code> can be used.</p></div></div><div class="top"><p class="src"><a id="v:runDelayed" class="def">runDelayed</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env a -&gt; env -&gt; <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> a) <a href="src/Servant-Server-Internal-RoutingApplication.html#runDelayed" class="link">Source</a> <a href="#v:runDelayed" class="selflink">#</a></p><div class="doc"><p>Run a delayed server. Performs all scheduled operations
 in order, and passes the results from the capture and body
 blocks on to the actual handler.</p><p>This should only be called once per request; otherwise the guarantees about
 effect and HTTP error ordering break down.</p></div></div><div class="top"><p class="src"><a id="v:runAction" class="def">runAction</a> :: <a href="Servant-Server-Internal-RoutingApplication.html#t:Delayed">Delayed</a> env (<a href="Servant-Server-Internal-ServantErr.html#t:Handler">Handler</a> a) -&gt; env -&gt; <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -&gt; (<a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> r) -&gt; (a -&gt; <a href="Servant-Server-Internal-RoutingApplication.html#t:RouteResult">RouteResult</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> r <a href="src/Servant-Server-Internal-RoutingApplication.html#runAction" class="link">Source</a> <a href="#v:runAction" class="selflink">#</a></p><div class="doc"><p>Runs a delayed server and the resulting action.
 Takes a continuation that lets us send a response.
 Also takes a continuation for how to turn the
 result of the delayed server into a response.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>