/usr/share/doc/libghc-simple-doc/html/Web-Simple-Controller-Trans.html is in libghc-simple-doc 0.11.1-1.
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 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.1: 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.8.2.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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.8.2.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.8.2.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.8.2.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.8.2.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.8.2.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.8.2.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.8.2.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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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.8.2.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.8.2.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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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.8.2.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.8.2.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.8.2.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.8.2.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.6.0/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.8.2.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.8.2.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.6.0/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.8.2.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.6.0/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"><li><a href="#v:parse">parse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> a</li></ul></li><li class="src short"><a href="#v:readQueryParam">readQueryParam</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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.8.2.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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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.8.2.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.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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.8.2.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.8.2.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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.8.2.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.8.2.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.8.2.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.8.2.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.8.2.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.8.2.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 name="t:ControllerT" class="def">ControllerT</a> s m a <a href="src/Web-Simple-Controller-Trans.html#ControllerT" class="link">Source</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 name="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><dl><dt class="src"><a name="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.8.2.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)</dt><dd class="doc empty"> </dd></dl><div class="clear"></div></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">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> m) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><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.8.2.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)</span> <a href="src/Web-Simple-Controller-Trans.html#line-102" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:hoistEither" class="def">hoistEither</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></p></div><div class="top"><p class="src"><a name="v:request" class="def">request</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></p><div class="doc"><p>Extract the request</p></div></div><div class="top"><p class="src"><a name="v:localRequest" class="def">localRequest</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></p><div class="doc"><p>Modify the request for the given computation</p></div></div><div class="top"><p class="src"><a name="v:controllerState" class="def">controllerState</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></p><div class="doc"><p>Extract the application-specific state</p></div></div><div class="top"><p class="src"><a name="v:putState" class="def">putState</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></p></div><div class="top"><p class="src"><a name="v:controllerApp" class="def">controllerApp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></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 name="v:respond" class="def">respond</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></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 name="v:fromApp" class="def">fromApp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></p><div class="doc"><p>Lift an application to a controller</p></div></div><div class="top"><p class="src"><a name="v:routeHost" class="def">routeHost</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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></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 name="v:routeTop" class="def">routeTop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></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 name="v:routeMethod" class="def">routeMethod</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></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 name="v:routeAccept" class="def">routeAccept</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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></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 name="v:routePattern" class="def">routePattern</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></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 name="v:routeName" class="def">routeName</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></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 name="v:routeVar" class="def">routeVar</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></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 name="v:queryParam" class="def">queryParam</a> <a href="src/Web-Simple-Controller-Trans.html#queryParam" class="link">Source</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.8.2.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.6.0/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.8.2.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.8.2.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 name="v:queryParam-39-" class="def">queryParam'</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.6.0/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></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 name="v:queryParams" class="def">queryParams</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.6.0/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></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 name="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></p><div class="doc"><p>The class of types into which query parameters may be converted</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:parse" class="def">parse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> a <a href="src/Web-Simple-Controller-Trans.html#parse" class="link">Source</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"><a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a></span> <a href="src/Web-Simple-Controller-Trans.html#line-255" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Web-Simple-Controller-Trans.html#t:Parseable">Parseable</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></span> <a href="src/Web-Simple-Controller-Trans.html#line-253" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><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></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:readQueryParam" class="def">readQueryParam</a> <a href="src/Web-Simple-Controller-Trans.html#readQueryParam" class="link">Source</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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.6.0/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.8.2.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 name="v:readQueryParam-39-" class="def">readQueryParam'</a> <a href="src/Web-Simple-Controller-Trans.html#readQueryParam%27" class="link">Source</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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.6.0/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 name="v:readQueryParams" class="def">readQueryParams</a> <a href="src/Web-Simple-Controller-Trans.html#readQueryParams" class="link">Source</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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.6.0/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 name="v:readParamValue" class="def">readParamValue</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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></p></div><div class="top"><p class="src"><a name="v:requestHeader" class="def">requestHeader</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a>) <a href="src/Web-Simple-Controller-Trans.html#requestHeader" class="link">Source</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.8.2.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 name="v:redirectBack" class="def">redirectBack</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></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 name="v:redirectBackOr" class="def">redirectBackOr</a> <a href="src/Web-Simple-Controller-Trans.html#redirectBackOr" class="link">Source</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.8.2.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 name="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></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 name="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></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 name="v:guard" class="def">guard</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></p></div><div class="top"><p class="src"><a name="v:guardM" class="def">guardM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.8.2.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></p></div><div class="top"><p class="src"><a name="v:guardReq" class="def">guardReq</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.8.2.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></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:ControllerException" class="def">ControllerException</a> <a href="src/Web-Simple-Controller-Trans.html#ControllerException" class="link">Source</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:ControllerException" class="def">ControllerException</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:err" class="def">err</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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></p></div><div class="doc"><p><a name="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.8.2.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.16.1</p></div></body></html>
|