/usr/share/doc/libghc-simple-doc/html/Web-Simple-Controller-Trans.html is in libghc-simple-doc 0.11.2-1build9.
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 59 60 61 | <!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>Web.Simple.Controller.Trans</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_Web-Simple-Controller-Trans.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Web-Simple-Controller-Trans.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">simple-0.11.2: A minimalist web framework for the WAI server interface</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Trustworthy</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Web.Simple.Controller.Trans</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p><code><a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a></code> provides a convenient syntax for writting <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Application">Application</a></code>
code as a Monadic action with access to an HTTP request as well as app
specific data (e.g. a database connection pool, app configuration etc.)
This module also defines some
helper functions that leverage this feature. For example, <code><a href="Web-Simple-Controller-Trans.html#v:redirectBack">redirectBack</a></code>
reads the underlying request to extract the referer and returns a redirect
response:</p><pre> myControllerT = do
...
if badLogin then
redirectBack
else
...
</pre></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">newtype</span> <a href="#t:ControllerT">ControllerT</a> s m a = <a href="#v:ControllerT">ControllerT</a> {<ul class="subs"><li><a href="#v:runController">runController</a> :: s -> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> a, s)</li></ul>}</li><li class="src short"><a href="#v:hoistEither">hoistEither</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a</li><li class="src short"><a href="#v:request">request</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a></li><li class="src short"><a href="#v:localRequest">localRequest</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a>) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a</li><li class="src short"><a href="#v:controllerState">controllerState</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m s</li><li class="src short"><a href="#v:putState">putState</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => s -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:controllerApp">controllerApp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => s -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:SimpleApplication">SimpleApplication</a> m</li><li class="src short"><a href="#v:respond">respond</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a</li><li class="src short"><a href="#v:fromApp">fromApp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> m <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a>) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:routeHost">routeHost</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:routeTop">routeTop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:routeMethod">routeMethod</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Method.html#t:StdMethod">StdMethod</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:routeAccept">routeAccept</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:routePattern">routePattern</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:routeName">routeName</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:routeVar">routeVar</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:queryParam">queryParam</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:queryParam-39-">queryParam'</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a</li><li class="src short"><a href="#v:queryParams">queryParams</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m [a]</li><li class="src short"><span class="keyword">class</span> <a href="#t:Parseable">Parseable</a> a <span class="keyword">where</span><ul class="subs"></ul></li><li class="src short"><a href="#v:readQueryParam">readQueryParam</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:readQueryParam-39-">readQueryParam'</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a</li><li class="src short"><a href="#v:readQueryParams">readQueryParams</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m [a]</li><li class="src short"><a href="#v:readParamValue">readParamValue</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a</li><li class="src short"><a href="#v:requestHeader">requestHeader</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Header.html#t:HeaderName">HeaderName</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:redirectBack">redirectBack</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:redirectBackOr">redirectBackOr</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><span class="keyword">type</span> <a href="#t:SimpleApplication">SimpleApplication</a> m = <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> m <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:SimpleMiddleware">SimpleMiddleware</a> m = <a href="Web-Simple-Controller-Trans.html#t:SimpleApplication">SimpleApplication</a> m -> <a href="Web-Simple-Controller-Trans.html#t:SimpleApplication">SimpleApplication</a> m</li><li class="src short"><a href="#v:guard">guard</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:guardM">guardM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><a href="#v:guardReq">guardReq</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</li><li class="src short"><span class="keyword">data</span> <a href="#t:ControllerException">ControllerException</a> = <a href="#v:ControllerException">ControllerException</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:err">err</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">newtype</span> <a id="t:ControllerT" class="def">ControllerT</a> s m a <a href="src/Web-Simple-Controller-Trans.html#ControllerT" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></p><div class="doc"><p>The ControllerT Monad is both a State-like monad which, when run, computes
either a <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a></code> or a result. Within the ControllerT Monad, the remainder
of the computation can be short-circuited by <code><a href="Web-Simple-Controller-Trans.html#v:respond">respond</a></code>ing with a <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a></code>.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:ControllerT" class="def">ControllerT</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><ul><li><dfn class="src"><a id="v:runController" class="def">runController</a> :: s -> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> a, s)</dfn><div class="doc empty"> </div></li></ul></div></td></tr></table></div><div class="subs instances"><p id="control.i:ControllerT" class="caption collapser" onclick="toggleSection('i:ControllerT')">Instances</p><div id="section.i:ControllerT" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerT:MonadBase:1" class="instance expander" onclick="toggleSection('i:id:ControllerT:MonadBase:1')"></span> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Applicative.html#t:Applicative">Applicative</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> m m) => <a href="file:///usr/share/doc/libghc-transformers-base-doc/html/Control-Monad-Base.html#t:MonadBase">MonadBase</a> m (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m)</span> <a href="src/Web-Simple-Controller-Trans.html#line-98" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:MonadBase:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:liftBase">liftBase</a> :: m α -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m α <a href="#v:liftBase" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerT:MonadBaseControl:2" class="instance expander" onclick="toggleSection('i:id:ControllerT:MonadBaseControl:2')"></span> <a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:MonadBaseControl">MonadBaseControl</a> m m => <a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:MonadBaseControl">MonadBaseControl</a> m (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m)</span> <a href="src/Web-Simple-Controller-Trans.html#line-101" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:MonadBaseControl:2" class="inst-details hide"><div class="subs associated-types"><p class="caption">Associated Types</p><p class="src"><span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:StM">StM</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a>) a :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> <a href="#t:StM" class="selflink">#</a></p></div> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:liftBaseWith">liftBaseWith</a> :: (<a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:RunInBase">RunInBase</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m) m -> m a) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:liftBaseWith" class="selflink">#</a></p><p class="src"><a href="#v:restoreM">restoreM</a> :: <a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:StM">StM</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m) a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:restoreM" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerT:MonadReader:3" class="instance expander" onclick="toggleSection('i:id:ControllerT:MonadReader:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m)</span> <a href="src/Web-Simple-Controller-Trans.html#line-91" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:MonadReader:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:ask">ask</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> <a href="#v:ask" class="selflink">#</a></p><p class="src"><a href="#v:local">local</a> :: (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a>) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:local" class="selflink">#</a></p><p class="src"><a href="#v:reader">reader</a> :: (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> a) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:reader" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerT:MonadState:4" class="instance expander" onclick="toggleSection('i:id:ControllerT:MonadState:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#t:MonadState">MonadState</a> s (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m)</span> <a href="src/Web-Simple-Controller-Trans.html#line-87" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:MonadState:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:get">get</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m s <a href="#v:get" class="selflink">#</a></p><p class="src"><a href="#v:put">put</a> :: s -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="#v:put" class="selflink">#</a></p><p class="src"><a href="#v:state">state</a> :: (s -> (a, s)) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:state" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerT:MonadTrans:5" class="instance expander" onclick="toggleSection('i:id:ControllerT:MonadTrans:5')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.5.2.0/Control-Monad-Trans-Class.html#t:MonadTrans">MonadTrans</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s)</span> <a href="src/Web-Simple-Controller-Trans.html#line-84" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:MonadTrans:5" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:lift">lift</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:lift" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerT:Monad:6" class="instance expander" onclick="toggleSection('i:id:ControllerT:Monad:6')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m)</span> <a href="src/Web-Simple-Controller-Trans.html#line-66" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:Monad:6" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-62--62--61-">(>>=)</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> (a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m b) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m b <a href="#v:-62--62--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62--62-">(>>)</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m b -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m b <a href="#v:-62--62-" class="selflink">#</a></p><p class="src"><a href="#v:return">return</a> :: a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m 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.1.0/Data-String.html#t:String">String</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m 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:ControllerT:Functor:7" class="instance expander" onclick="toggleSection('i:id:ControllerT:Functor:7')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Functor.html#t:Functor">Functor</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Functor.html#t:Functor">Functor</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m)</span> <a href="src/Web-Simple-Controller-Trans.html#line-55" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:Functor:7" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fmap">fmap</a> :: (a -> b) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m b <a href="#v:fmap" class="selflink">#</a></p><p class="src"><a href="#v:-60--36-">(<$)</a> :: a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m b -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m 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:ControllerT:Applicative:8" class="instance expander" onclick="toggleSection('i:id:ControllerT:Applicative:8')"></span> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Functor.html#t:Functor">Functor</a> m) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m)</span> <a href="src/Web-Simple-Controller-Trans.html#line-62" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:Applicative:8" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:pure">pure</a> :: a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:pure" class="selflink">#</a></p><p class="src"><a href="#v:-60--42--62-">(<*>)</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m (a -> b) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m b <a href="#v:-60--42--62-" class="selflink">#</a></p><p class="src"><a href="#v:-42--62-">(*>)</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m b -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m b <a href="#v:-42--62-" class="selflink">#</a></p><p class="src"><a href="#v:-60--42-">(<*)</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m b -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m 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:ControllerT:MonadIO:9" class="instance expander" onclick="toggleSection('i:id:ControllerT:MonadIO:9')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m)</span> <a href="src/Web-Simple-Controller-Trans.html#line-95" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:MonadIO:9" 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.1.0/System-IO.html#t:IO">IO</a> a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:liftIO" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerT:Alternative:10" class="instance expander" onclick="toggleSection('i:id:ControllerT:Alternative:10')"></span> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Functor.html#t:Functor">Functor</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Applicative.html#t:Alternative">Alternative</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m)</span> <a href="src/Web-Simple-Controller-Trans.html#line-76" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:Alternative:10" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:empty">empty</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:empty" class="selflink">#</a></p><p class="src"><a href="#v:-60--124--62-">(<|>)</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:-60--124--62-" class="selflink">#</a></p><p class="src"><a href="#v:some">some</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m [a] <a href="#v:some" class="selflink">#</a></p><p class="src"><a href="#v:many">many</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m [a] <a href="#v:many" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerT:MonadPlus:11" class="instance expander" onclick="toggleSection('i:id:ControllerT:MonadPlus:11')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m)</span> <a href="src/Web-Simple-Controller-Trans.html#line-80" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:MonadPlus:11" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:mzero">mzero</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:mzero" class="selflink">#</a></p><p class="src"><a href="#v:mplus">mplus</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="#v:mplus" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerT:StM:12" class="instance expander" onclick="toggleSection('i:id:ControllerT:StM:12')"></span> <span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:StM">StM</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m) a</span> <a href="src/Web-Simple-Controller-Trans.html#line-102" class="link">Source</a> <a href="#t:ControllerT" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerT:StM:12" class="inst-details hide"><div class="src"><span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:StM">StM</a> (<a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m) a = (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> a, s)</div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:hoistEither" class="def">hoistEither</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="src/Web-Simple-Controller-Trans.html#hoistEither" class="link">Source</a> <a href="#v:hoistEither" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:request" class="def">request</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> <a href="src/Web-Simple-Controller-Trans.html#request" class="link">Source</a> <a href="#v:request" class="selflink">#</a></p><div class="doc"><p>Extract the request</p></div></div><div class="top"><p class="src"><a id="v:localRequest" class="def">localRequest</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a>) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="src/Web-Simple-Controller-Trans.html#localRequest" class="link">Source</a> <a href="#v:localRequest" class="selflink">#</a></p><div class="doc"><p>Modify the request for the given computation</p></div></div><div class="top"><p class="src"><a id="v:controllerState" class="def">controllerState</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m s <a href="src/Web-Simple-Controller-Trans.html#controllerState" class="link">Source</a> <a href="#v:controllerState" class="selflink">#</a></p><div class="doc"><p>Extract the application-specific state</p></div></div><div class="top"><p class="src"><a id="v:putState" class="def">putState</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => s -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#putState" class="link">Source</a> <a href="#v:putState" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:controllerApp" class="def">controllerApp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => s -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:SimpleApplication">SimpleApplication</a> m <a href="src/Web-Simple-Controller-Trans.html#controllerApp" class="link">Source</a> <a href="#v:controllerApp" class="selflink">#</a></p><div class="doc"><p>Convert the controller into an <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Application">Application</a></code></p></div></div><div class="top"><p class="src"><a id="v:respond" class="def">respond</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="src/Web-Simple-Controller-Trans.html#respond" class="link">Source</a> <a href="#v:respond" class="selflink">#</a></p><div class="doc"><p>Provide a response</p><pre>respond r >>= f === respond r</pre></div></div><div class="top"><p class="src"><a id="v:fromApp" class="def">fromApp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> m <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a>) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#fromApp" class="link">Source</a> <a href="#v:fromApp" class="selflink">#</a></p><div class="doc"><p>Lift an application to a controller</p></div></div><div class="top"><p class="src"><a id="v:routeHost" class="def">routeHost</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#routeHost" class="link">Source</a> <a href="#v:routeHost" class="selflink">#</a></p><div class="doc"><p>Matches on the hostname from the <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a></code>. The route only succeeds on
exact matches.</p></div></div><div class="top"><p class="src"><a id="v:routeTop" class="def">routeTop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#routeTop" class="link">Source</a> <a href="#v:routeTop" class="selflink">#</a></p><div class="doc"><p>Matches if the path is empty.</p><p>Note that this route checks that <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#v:pathInfo">pathInfo</a></code>
is empty, so it works as expected in nested contexts that have
popped components from the <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#v:pathInfo">pathInfo</a></code> list.</p></div></div><div class="top"><p class="src"><a id="v:routeMethod" class="def">routeMethod</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Method.html#t:StdMethod">StdMethod</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#routeMethod" class="link">Source</a> <a href="#v:routeMethod" class="selflink">#</a></p><div class="doc"><p>Matches on the HTTP request method (e.g. <code><a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Method.html#v:GET">GET</a></code>, <code><a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Method.html#v:POST">POST</a></code>, <code><a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Method.html#v:PUT">PUT</a></code>)</p></div></div><div class="top"><p class="src"><a id="v:routeAccept" class="def">routeAccept</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#routeAccept" class="link">Source</a> <a href="#v:routeAccept" class="selflink">#</a></p><div class="doc"><p>Matches if the request's Content-Type exactly matches the given string</p></div></div><div class="top"><p class="src"><a id="v:routePattern" class="def">routePattern</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#routePattern" class="link">Source</a> <a href="#v:routePattern" class="selflink">#</a></p><div class="doc"><p>Routes the given URL pattern. Patterns can include
directories as well as variable patterns (prefixed with <code>:</code>) to be added
to <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#v:queryString">queryString</a></code> (see <code><a href="Web-Simple-Controller-Trans.html#v:routeVar">routeVar</a></code>)</p><ul><li>/posts/:id</li><li>/posts/:id/new</li><li>/:date/posts/:category/new</li></ul></div></div><div class="top"><p class="src"><a id="v:routeName" class="def">routeName</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#routeName" class="link">Source</a> <a href="#v:routeName" class="selflink">#</a></p><div class="doc"><p>Matches if the first directory in the path matches the given <code>ByteString</code></p></div></div><div class="top"><p class="src"><a id="v:routeVar" class="def">routeVar</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#routeVar" class="link">Source</a> <a href="#v:routeVar" class="selflink">#</a></p><div class="doc"><p>Always matches if there is at least one directory in <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#v:pathInfo">pathInfo</a></code> but and
adds a parameter to <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#v:queryString">queryString</a></code> where the key is the first parameter and
the value is the directory consumed from the path.</p></div></div><div class="top"><p class="src"><a id="v:queryParam" class="def">queryParam</a> <a href="src/Web-Simple-Controller-Trans.html#queryParam" class="link">Source</a> <a href="#v:queryParam" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></td><td class="doc"><p>Parameter name</p></td></tr><tr><td class="src">-> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Looks up the parameter name in the request's query string and returns the
<code>Parseable</code> value or <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#v:Nothing">Nothing</a></code>.</p><p>For example, for a request with query string: "?foo=bar&baz=7",
<code>queryParam "foo"</code>
would return <code>Just "bar"</code>, but
<code>queryParam "zap"</code>
would return <code>Nothing</code>.</p></div></div><div class="top"><p class="src"><a id="v:queryParam-39-" class="def">queryParam'</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="src/Web-Simple-Controller-Trans.html#queryParam%27" class="link">Source</a> <a href="#v:queryParam-39-" class="selflink">#</a></p><div class="doc"><p>Like <code><a href="Web-Simple-Controller-Trans.html#v:queryParam">queryParam</a></code>, but throws an exception if the parameter is not present.</p></div></div><div class="top"><p class="src"><a id="v:queryParams" class="def">queryParams</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m [a] <a href="src/Web-Simple-Controller-Trans.html#queryParams" class="link">Source</a> <a href="#v:queryParams" class="selflink">#</a></p><div class="doc"><p>Selects all values with the given parameter name</p></div></div><div class="top"><p class="src"><span class="keyword">class</span> <a id="t:Parseable" class="def">Parseable</a> a <span class="keyword">where</span> <a href="src/Web-Simple-Controller-Trans.html#Parseable" class="link">Source</a> <a href="#t:Parseable" class="selflink">#</a></p><div class="doc"><p>The class of types into which query parameters may be converted</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Web-Simple-Controller-Trans.html#v:parse">parse</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a id="v:parse" class="def">parse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> a <a href="src/Web-Simple-Controller-Trans.html#parse" class="link">Source</a> <a href="#v:parse" class="selflink">#</a></p></div><div class="subs instances"><p id="control.i:Parseable" class="caption collapser" onclick="toggleSection('i:Parseable')">Instances</p><div id="section.i:Parseable" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:Parseable:Parseable:1" class="instance expander" onclick="toggleSection('i:ic:Parseable:Parseable:1')"></span> <a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></span> <a href="src/Web-Simple-Controller-Trans.html#line-253" class="link">Source</a> <a href="#t:Parseable" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:ic:Parseable:Parseable:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:parse">parse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Web-Simple-Controller-Trans.html#parse" class="link">Source</a> <a href="#v:parse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:Parseable:Parseable:2" class="instance expander" onclick="toggleSection('i:ic:Parseable:Parseable:2')"></span> <a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></span> <a href="src/Web-Simple-Controller-Trans.html#line-255" class="link">Source</a> <a href="#t:Parseable" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:ic:Parseable:Parseable:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:parse">parse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="src/Web-Simple-Controller-Trans.html#parse" class="link">Source</a> <a href="#v:parse" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:Parseable:Parseable:3" class="instance expander" onclick="toggleSection('i:ic:Parseable:Parseable:3')"></span> <a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a></span> <a href="src/Web-Simple-Controller-Trans.html#line-257" class="link">Source</a> <a href="#t:Parseable" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:ic:Parseable:Parseable:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:parse">parse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> <a href="src/Web-Simple-Controller-Trans.html#parse" class="link">Source</a> <a href="#v:parse" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:readQueryParam" class="def">readQueryParam</a> <a href="src/Web-Simple-Controller-Trans.html#readQueryParam" class="link">Source</a> <a href="#v:readQueryParam" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></td><td class="doc"><p>Parameter name</p></td></tr><tr><td class="src">-> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Like <code><a href="Web-Simple-Controller-Trans.html#v:queryParam">queryParam</a></code>, but further processes the parameter value with <code>read</code>.
If that conversion fails, an exception is thrown.</p></div></div><div class="top"><p class="src"><a id="v:readQueryParam-39-" class="def">readQueryParam'</a> <a href="src/Web-Simple-Controller-Trans.html#readQueryParam%27" class="link">Source</a> <a href="#v:readQueryParam-39-" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></td><td class="doc"><p>Parameter name</p></td></tr><tr><td class="src">-> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Like <code><a href="Web-Simple-Controller-Trans.html#v:readQueryParam">readQueryParam</a></code>, but throws an exception if the parameter is not present.</p></div></div><div class="top"><p class="src"><a id="v:readQueryParams" class="def">readQueryParams</a> <a href="src/Web-Simple-Controller-Trans.html#readQueryParams" class="link">Source</a> <a href="#v:readQueryParams" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></td><td class="doc"><p>Parameter name</p></td></tr><tr><td class="src">-> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m [a]</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Like <code><a href="Web-Simple-Controller-Trans.html#v:queryParams">queryParams</a></code>, but further processes the parameter values with <code>read</code>.
If any read-conversion fails, an exception is thrown.</p></div></div><div class="top"><p class="src"><a id="v:readParamValue" class="def">readParamValue</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="src/Web-Simple-Controller-Trans.html#readParamValue" class="link">Source</a> <a href="#v:readParamValue" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:requestHeader" class="def">requestHeader</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Header.html#t:HeaderName">HeaderName</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a>) <a href="src/Web-Simple-Controller-Trans.html#requestHeader" class="link">Source</a> <a href="#v:requestHeader" class="selflink">#</a></p><div class="doc"><p>Returns the value of the given request header or <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if it is not
present in the HTTP request.</p></div></div><div class="top"><p class="src"><a id="v:redirectBack" class="def">redirectBack</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#redirectBack" class="link">Source</a> <a href="#v:redirectBack" class="selflink">#</a></p><div class="doc"><p>Redirect back to the referer. If the referer header is not present
redirect to root (i.e., <code>/</code>).</p></div></div><div class="top"><p class="src"><a id="v:redirectBackOr" class="def">redirectBackOr</a> <a href="src/Web-Simple-Controller-Trans.html#redirectBackOr" class="link">Source</a> <a href="#v:redirectBackOr" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a></td><td class="doc"><p>Fallback response</p></td></tr><tr><td class="src">-> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m ()</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Redirect back to the referer. If the referer header is not present
fallback on the given <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a></code>.</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:SimpleApplication" class="def">SimpleApplication</a> m = <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> m <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a> <a href="src/Web-Simple-Controller-Trans.html#SimpleApplication" class="link">Source</a> <a href="#t:SimpleApplication" class="selflink">#</a></p><div class="doc"><p>Like <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Application">Application</a></code>, but with <code>m</code> as the underlying monad</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:SimpleMiddleware" class="def">SimpleMiddleware</a> m = <a href="Web-Simple-Controller-Trans.html#t:SimpleApplication">SimpleApplication</a> m -> <a href="Web-Simple-Controller-Trans.html#t:SimpleApplication">SimpleApplication</a> m <a href="src/Web-Simple-Controller-Trans.html#SimpleMiddleware" class="link">Source</a> <a href="#t:SimpleMiddleware" class="selflink">#</a></p><div class="doc"><p>Like <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Application">Application</a></code>, but with <code>m</code> as the underlying monad</p></div></div><div class="top"><p class="src"><a id="v:guard" class="def">guard</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#guard" class="link">Source</a> <a href="#v:guard" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:guardM" class="def">guardM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#guardM" class="link">Source</a> <a href="#v:guardM" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:guardReq" class="def">guardReq</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (<a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Request">Request</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m () <a href="src/Web-Simple-Controller-Trans.html#guardReq" class="link">Source</a> <a href="#v:guardReq" class="selflink">#</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:ControllerException" class="def">ControllerException</a> <a href="src/Web-Simple-Controller-Trans.html#ControllerException" class="link">Source</a> <a href="#t:ControllerException" class="selflink">#</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:ControllerException" class="def">ControllerException</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></td><td class="doc empty"> </td></tr></table></div><div class="subs instances"><p id="control.i:ControllerException" class="caption collapser" onclick="toggleSection('i:ControllerException')">Instances</p><div id="section.i:ControllerException" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerException:Show:1" class="instance expander" onclick="toggleSection('i:id:ControllerException:Show:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> <a href="Web-Simple-Controller-Trans.html#t:ControllerException">ControllerException</a></span> <a href="src/Web-Simple-Controller-Trans.html#line-335" class="link">Source</a> <a href="#t:ControllerException" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerException:Show:1" 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.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerException">ControllerException</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="Web-Simple-Controller-Trans.html#t:ControllerException">ControllerException</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="Web-Simple-Controller-Trans.html#t:ControllerException">ControllerException</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ControllerException:Exception:2" class="instance expander" onclick="toggleSection('i:id:ControllerException:Exception:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Exception-Base.html#t:Exception">Exception</a> <a href="Web-Simple-Controller-Trans.html#t:ControllerException">ControllerException</a></span> <a href="src/Web-Simple-Controller-Trans.html#line-338" class="link">Source</a> <a href="#t:ControllerException" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:ControllerException:Exception:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toException">toException</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerException">ControllerException</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Exception-Base.html#t:SomeException">SomeException</a> <a href="#v:toException" class="selflink">#</a></p><p class="src"><a href="#v:fromException">fromException</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Exception-Base.html#t:SomeException">SomeException</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Web-Simple-Controller-Trans.html#t:ControllerException">ControllerException</a> <a href="#v:fromException" class="selflink">#</a></p><p class="src"><a href="#v:displayException">displayException</a> :: <a href="Web-Simple-Controller-Trans.html#t:ControllerException">ControllerException</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:displayException" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:err" class="def">err</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -> <a href="Web-Simple-Controller-Trans.html#t:ControllerT">ControllerT</a> s m a <a href="src/Web-Simple-Controller-Trans.html#err" class="link">Source</a> <a href="#v:err" class="selflink">#</a></p></div><div class="doc"><p><a id="example"></a></p><p>The most basic <code>Routeable</code> types are <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Application">Application</a></code> and <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Response">Response</a></code>. Reaching
either of these types marks a termination in the routing lookup. This module
exposes a monadic type <code>Route</code> which makes it easy to create routing logic
in a DSL-like fashion.</p><p><code>Route</code>s are concatenated using the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#v:-62--62-">>></a></code> operator (or using do-notation).
In the end, any <code>Routeable</code>, including a <code>Route</code> is converted to an
<code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Application">Application</a></code> and passed to the server using <code>mkRoute</code>:</p><pre>
mainAction :: ControllerT () ()
mainAction = ...
signinForm :: ControllerT () ()
signinForm req = ...
login :: ControllerT () ()
login = ...
updateProfile :: ControllerT () ()
updateProfile = ...
main :: IO ()
main = run 3000 $ controllerApp () $ do
routeTop mainAction
routeName "sessions" $ do
routeMethod GET signinForm
routeMethod POST login
routeMethod PUT $ routePattern "users/:id" updateProfile
routeAll $ responseLBS status404 [] "Are you in the right place?"
</pre></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|