/usr/share/doc/libghc-happstack-server-doc/html/Happstack-Server-RqData.html is in libghc-happstack-server-doc 6.6.3-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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | <!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>Happstack.Server.RqData</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_Happstack-Server-RqData.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Happstack-Server-RqData.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">happstack-server-6.6.3: Web related tools and services.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">Happstack.Server.RqData</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Looking up keys
</a><ul><li><a href="#g:2">Form Values and Query Parameters
</a></li><li><a href="#g:3">Cookies
</a></li><li><a href="#g:4">low-level
</a></li></ul></li><li><a href="#g:5">Filters
</a></li><li><a href="#g:6">Validation and Parsing
</a></li><li><a href="#g:7">Handling POST/PUT Requests
</a><ul><li><a href="#g:8">Body Policy
</a></li></ul></li><li><a href="#g:9">RqData Monad & Error Reporting
</a><ul><li><a href="#g:10">Using RqData with ServerMonad
</a></li></ul></li><li><a href="#g:11">HasRqData class
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Functions for extracting values from the query string, form data, cookies, etc.
</p><p>For in-depth documentation see the following section of the Happstack Crash Course:
</p><p><a href="http://happstack.com/docs/crashcourse/RqData.html">http://happstack.com/docs/crashcourse/RqData.html</a>
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:look">look</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:looks">looks</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>]</li><li class="src short"><a href="#v:lookText">lookText</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:lookText-39-">lookText'</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:lookTexts">lookTexts</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [<a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Lazy-Internal.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:lookTexts-39-">lookTexts'</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [<a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Internal.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:lookBS">lookBS</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:lookBSs">lookBSs</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:lookRead">lookRead</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-Internal-Types.html#t:FromReqURI">FromReqURI</a> a) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m a</li><li class="src short"><a href="#v:lookReads">lookReads</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-Internal-Types.html#t:FromReqURI">FromReqURI</a> a) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [a]</li><li class="src short"><a href="#v:lookFile">lookFile</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:FilePath">FilePath</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:FilePath">FilePath</a>, <a href="Happstack-Server-Internal-Types.html#t:ContentType">ContentType</a>)</li><li class="src short"><a href="#v:lookPairs">lookPairs</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => m [(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:FilePath">FilePath</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>)]</li><li class="src short"><a href="#v:lookPairsBS">lookPairsBS</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => m [(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:FilePath">FilePath</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>)]</li><li class="src short"><a href="#v:lookCookie">lookCookie</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="Happstack-Server-Internal-Cookie.html#t:Cookie">Cookie</a></li><li class="src short"><a href="#v:lookCookieValue">lookCookieValue</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:readCookieValue">readCookieValue</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-Internal-Types.html#t:FromReqURI">FromReqURI</a> a) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m a</li><li class="src short"><a href="#v:lookInput">lookInput</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="Happstack-Server-Internal-Types.html#t:Input">Input</a></li><li class="src short"><a href="#v:lookInputs">lookInputs</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [<a href="Happstack-Server-Internal-Types.html#t:Input">Input</a>]</li><li class="src short"><a href="#v:body">body</a> :: <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m => m a -> m a</li><li class="src short"><a href="#v:queryString">queryString</a> :: <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m => m a -> m a</li><li class="src short"><a href="#v:bytestring">bytestring</a> :: <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m => m a -> m a</li><li class="src short"><a href="#v:checkRq">checkRq</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => m a -> (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> b) -> m b</li><li class="src short"><a href="#v:checkRqM">checkRqM</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => m a -> (a -> m (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> b)) -> m b</li><li class="src short"><a href="#v:readRq">readRq</a> :: <a href="Happstack-Server-Internal-Types.html#t:FromReqURI">FromReqURI</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> a</li><li class="src short"><a href="#v:unsafeReadRq">unsafeReadRq</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Read.html#t:Read">Read</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> a</li><li class="src short"><a href="#v:decodeBody">decodeBody</a> :: (<a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m, <a href="/usr/share/doc/libghc-transformers-doc/html/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m, <a href="Happstack-Server-Internal-Monads.html#t:WebMonad">WebMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m) => <a href="Happstack-Server-RqData.html#t:BodyPolicy">BodyPolicy</a> -> m <a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:BodyPolicy">BodyPolicy</a> = <a href="#v:BodyPolicy">BodyPolicy</a> {<ul class="subs"><li><a href="#v:inputWorker">inputWorker</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Happstack-Server-Internal-Multipart.html#t:InputWorker">InputWorker</a></li><li><a href="#v:maxDisk">maxDisk</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></li><li><a href="#v:maxRAM">maxRAM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></li><li><a href="#v:maxHeader">maxHeader</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></li></ul>}</li><li class="src short"><a href="#v:defaultBodyPolicy">defaultBodyPolicy</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Happstack-Server-RqData.html#t:BodyPolicy">BodyPolicy</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:RqData">RqData</a> a</li><li class="src short"><a href="#v:mapRqData">mapRqData</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>) a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>) b) -> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a> a -> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a> b</li><li class="src short"><span class="keyword">newtype</span> <a href="#t:Errors">Errors</a> a = <a href="#v:Errors">Errors</a> {<ul class="subs"><li><a href="#v:unErrors">unErrors</a> :: [a]</li></ul>}</li><li class="src short"><a href="#v:getDataFn">getDataFn</a> :: (<a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a> m) => <a href="Happstack-Server-RqData.html#t:RqData">RqData</a> a -> m (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> [<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>] a)</li><li class="src short"><a href="#v:withDataFn">withDataFn</a> :: (<a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m, <a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a> m) => <a href="Happstack-Server-RqData.html#t:RqData">RqData</a> a -> (a -> m r) -> m r</li><li class="src short"><span class="keyword">class</span> <a href="#t:FromData">FromData</a> a <span class="keyword">where</span><ul class="subs"><li><a href="#v:fromData">fromData</a> :: <a href="Happstack-Server-RqData.html#t:RqData">RqData</a> a</li></ul></li><li class="src short"><a href="#v:getData">getData</a> :: (<a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a> m, <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> a) => m (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> [<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>] a)</li><li class="src short"><a href="#v:withData">withData</a> :: (<a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m, <a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a> m) => (a -> m r) -> m r</li><li class="src short"><span class="keyword">type</span> <a href="#t:RqEnv">RqEnv</a> = ([(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>, <a href="Happstack-Server-Internal-Types.html#t:Input">Input</a>)], <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> [(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>, <a href="Happstack-Server-Internal-Types.html#t:Input">Input</a>)], [(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>, <a href="Happstack-Server-Internal-Cookie.html#t:Cookie">Cookie</a>)])</li><li class="src short"><span class="keyword">class</span> <a href="#t:HasRqData">HasRqData</a> m <span class="keyword">where</span><ul class="subs"><li><a href="#v:askRqEnv">askRqEnv</a> :: m <a href="Happstack-Server-RqData.html#t:RqEnv">RqEnv</a></li><li><a href="#v:localRqEnv">localRqEnv</a> :: (<a href="Happstack-Server-RqData.html#t:RqEnv">RqEnv</a> -> <a href="Happstack-Server-RqData.html#t:RqEnv">RqEnv</a>) -> m a -> m a</li><li><a href="#v:rqDataError">rqDataError</a> :: <a href="Happstack-Server-RqData.html#t:Errors">Errors</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m a</li></ul></li></ul></div><div id="interface"><h1 id="g:1">Looking up keys
</h1><h2 id="g:2">Form Values and Query Parameters
</h2><div class="top"><p class="src"><a name="v:look" class="def">look</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a><a href="src/Happstack-Server-RqData.html#look" class="link">Source</a></p><div class="doc"><p>Gets the first matching named input parameter as a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></code>
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>This function assumes the underlying octets are UTF-8 encoded.
</p><p>Example:
</p><pre> handler :: ServerPart Response
handler =
do foo <- look "foo"
ok $ toResponse $ "foo = " ++ foo
</pre><p>see also: <code><a href="Happstack-Server-RqData.html#v:looks">looks</a></code>, <code><a href="Happstack-Server-RqData.html#v:lookBS">lookBS</a></code>, and <code><a href="Happstack-Server-RqData.html#v:lookBSs">lookBSs</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:looks" class="def">looks</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>]<a href="src/Happstack-Server-RqData.html#looks" class="link">Source</a></p><div class="doc"><p>Gets all matches for the named input parameter as <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></code>s
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>This function assumes the underlying octets are UTF-8 encoded.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:look">look</a></code> and <code><a href="Happstack-Server-RqData.html#v:lookBSs">lookBSs</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookText" class="def">lookText</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Happstack-Server-RqData.html#lookText" class="link">Source</a></p><div class="doc"><p>Gets the first matching named input parameter as a lazy <code><a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Internal.html#t:Text">Text</a></code>
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>This function assumes the underlying octets are UTF-8 encoded.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookTexts">lookTexts</a></code>, <code><a href="Happstack-Server-RqData.html#v:look">look</a></code>, <code><a href="Happstack-Server-RqData.html#v:looks">looks</a></code>, <code><a href="Happstack-Server-RqData.html#v:lookBS">lookBS</a></code>, and <code><a href="Happstack-Server-RqData.html#v:lookBSs">lookBSs</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookText-39-" class="def">lookText'</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Internal.html#t:Text">Text</a><a href="src/Happstack-Server-RqData.html#lookText%27" class="link">Source</a></p><div class="doc"><p>Gets the first matching named input parameter as a strict <code><a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Internal.html#t:Text">Text</a></code>
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>This function assumes the underlying octets are UTF-8 encoded.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookTexts">lookTexts</a></code>, <code><a href="Happstack-Server-RqData.html#v:look">look</a></code>, <code><a href="Happstack-Server-RqData.html#v:looks">looks</a></code>, <code><a href="Happstack-Server-RqData.html#v:lookBS">lookBS</a></code>, and <code><a href="Happstack-Server-RqData.html#v:lookBSs">lookBSs</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookTexts" class="def">lookTexts</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [<a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Lazy-Internal.html#t:Text">Text</a>]<a href="src/Happstack-Server-RqData.html#lookTexts" class="link">Source</a></p><div class="doc"><p>Gets all matches for the named input parameter as lazy <code><a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Internal.html#t:Text">Text</a></code>s
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>This function assumes the underlying octets are UTF-8 encoded.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookText">lookText</a></code>, <code><a href="Happstack-Server-RqData.html#v:looks">looks</a></code> and <code><a href="Happstack-Server-RqData.html#v:lookBSs">lookBSs</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookTexts-39-" class="def">lookTexts'</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [<a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Internal.html#t:Text">Text</a>]<a href="src/Happstack-Server-RqData.html#lookTexts%27" class="link">Source</a></p><div class="doc"><p>Gets all matches for the named input parameter as strict <code><a href="/usr/share/doc/libghc-text-doc/html/Data-Text-Internal.html#t:Text">Text</a></code>s
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>This function assumes the underlying octets are UTF-8 encoded.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookText-39-">lookText'</a></code>, <code><a href="Happstack-Server-RqData.html#v:looks">looks</a></code> and <code><a href="Happstack-Server-RqData.html#v:lookBSs">lookBSs</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookBS" class="def">lookBS</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Happstack-Server-RqData.html#lookBS" class="link">Source</a></p><div class="doc"><p>Gets the first matching named input parameter as a lazy <code>ByteString</code>
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookBSs">lookBSs</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookBSs" class="def">lookBSs</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>]<a href="src/Happstack-Server-RqData.html#lookBSs" class="link">Source</a></p><div class="doc"><p>Gets all matches for the named input parameter as lazy <code>ByteString</code>s
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookBS">lookBS</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookRead" class="def">lookRead</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-Internal-Types.html#t:FromReqURI">FromReqURI</a> a) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m a<a href="src/Happstack-Server-RqData.html#lookRead" class="link">Source</a></p><div class="doc"><p>Gets the first matching named input parameter and decodes it using <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Read.html#t:Read">Read</a></code>
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>This function assumes the underlying octets are UTF-8 encoded.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookReads">lookReads</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookReads" class="def">lookReads</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-Internal-Types.html#t:FromReqURI">FromReqURI</a> a) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [a]<a href="src/Happstack-Server-RqData.html#lookReads" class="link">Source</a></p><div class="doc"><p>Gets all matches for the named input parameter and decodes them using <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Read.html#t:Read">Read</a></code>
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>This function assumes the underlying octets are UTF-8 encoded.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookReads">lookReads</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookFile" class="def">lookFile</a><a href="src/Happstack-Server-RqData.html#lookFile" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>name of input field to search for
</p></td></tr><tr><td class="src">-> m (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:FilePath">FilePath</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:FilePath">FilePath</a>, <a href="Happstack-Server-Internal-Types.html#t:ContentType">ContentType</a>)</td><td class="doc"><p>(temporary file location, uploaded file name, content-type)
</p></td></tr></table></div><div class="doc"><p>Gets the first matching named file
</p><p>Files can only appear in the request body. Additionally, the form
must set enctype="multipart/form-data".
</p><p>This function returns a tuple consisting of:
</p><ol><li> The temporary location of the uploaded file
</li><li> The local filename supplied by the browser
</li><li> The content-type supplied by the browser
</li></ol><p>NOTE: You must move the file from the temporary location before the
<code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code> is sent. The temporary files are automatically removed
after the <code><a href="Happstack-Server-Internal-Types.html#t:Response">Response</a></code> is sent.
</p></div></div><div class="top"><p class="src"><a name="v:lookPairs" class="def">lookPairs</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => m [(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:FilePath">FilePath</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>)]<a href="src/Happstack-Server-RqData.html#lookPairs" class="link">Source</a></p><div class="doc"><p>gets all the input parameters, and converts them to a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></code>
</p><p>The results will contain the QUERY_STRING followed by the Request
body.
</p><p>This function assumes the underlying octets are UTF-8 encoded.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookPairsBS">lookPairsBS</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookPairsBS" class="def">lookPairsBS</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => m [(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:FilePath">FilePath</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>)]<a href="src/Happstack-Server-RqData.html#lookPairsBS" class="link">Source</a></p><div class="doc"><p>gets all the input parameters
</p><p>The results will contain the QUERY_STRING followed by the Request
body.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookPairs">lookPairs</a></code>
</p></div></div><h2 id="g:3">Cookies
</h2><div class="top"><p class="src"><a name="v:lookCookie" class="def">lookCookie</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="Happstack-Server-Internal-Cookie.html#t:Cookie">Cookie</a><a href="src/Happstack-Server-RqData.html#lookCookie" class="link">Source</a></p><div class="doc"><p>Gets the named cookie
the cookie name is case insensitive
</p></div></div><div class="top"><p class="src"><a name="v:lookCookieValue" class="def">lookCookieValue</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a><a href="src/Happstack-Server-RqData.html#lookCookieValue" class="link">Source</a></p><div class="doc"><p>gets the named cookie as a string
</p></div></div><div class="top"><p class="src"><a name="v:readCookieValue" class="def">readCookieValue</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-Internal-Types.html#t:FromReqURI">FromReqURI</a> a) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m a<a href="src/Happstack-Server-RqData.html#readCookieValue" class="link">Source</a></p><div class="doc"><p>gets the named cookie as the requested Read type
</p></div></div><h2 id="g:4">low-level
</h2><div class="top"><p class="src"><a name="v:lookInput" class="def">lookInput</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m <a href="Happstack-Server-Internal-Types.html#t:Input">Input</a><a href="src/Happstack-Server-RqData.html#lookInput" class="link">Source</a></p><div class="doc"><p>Gets the first matching named input parameter
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookInputs">lookInputs</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:lookInputs" class="def">lookInputs</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m [<a href="Happstack-Server-Internal-Types.html#t:Input">Input</a>]<a href="src/Happstack-Server-RqData.html#lookInputs" class="link">Source</a></p><div class="doc"><p>Gets all matches for the named input parameter
</p><p>Searches the QUERY_STRING followed by the Request body.
</p><p>see also: <code><a href="Happstack-Server-RqData.html#v:lookInput">lookInput</a></code>
</p></div></div><h1 id="g:5">Filters
</h1><div class="top"><p class="src"><a name="v:body" class="def">body</a> :: <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m => m a -> m a<a href="src/Happstack-Server-RqData.html#body" class="link">Source</a></p><div class="doc"><p>limit the scope to the Request body
</p><pre> handler :: ServerPart Response
handler =
do foo <- body $ look "foo"
ok $ toResponse $ "foo = " ++ foo
</pre></div></div><div class="top"><p class="src"><a name="v:queryString" class="def">queryString</a> :: <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m => m a -> m a<a href="src/Happstack-Server-RqData.html#queryString" class="link">Source</a></p><div class="doc"><p>limit the scope to the QUERY_STRING
</p><pre> handler :: ServerPart Response
handler =
do foo <- queryString $ look "foo"
ok $ toResponse $ "foo = " ++ foo
</pre></div></div><div class="top"><p class="src"><a name="v:bytestring" class="def">bytestring</a> :: <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m => m a -> m a<a href="src/Happstack-Server-RqData.html#bytestring" class="link">Source</a></p><div class="doc"><p>limit the scope to <code><a href="Happstack-Server-Internal-Types.html#t:Input">Input</a></code>s which produce a <code>ByteString</code> (aka, not a file)
</p></div></div><h1 id="g:6">Validation and Parsing
</h1><div class="top"><p class="src"><a name="v:checkRq" class="def">checkRq</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => m a -> (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> b) -> m b<a href="src/Happstack-Server-RqData.html#checkRq" class="link">Source</a></p><div class="doc"><p>convert or validate a value
</p><p>This is similar to <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fmap">fmap</a></code> except that the function can fail by
returning Left and an error message. The error will be propagated
by calling <code><a href="Happstack-Server-RqData.html#v:rqDataError">rqDataError</a></code>.
</p><p>This function is useful for a number of things including:
</p><ol><li> Parsing a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></code> into another type
</li><li> Checking that a value meets some requirements (for example, that is an Int between 1 and 10).
</li></ol><p>Example usage at:
</p><p><a href="http://happstack.com/docs/crashcourse/RqData.html#rqdatacheckrq">http://happstack.com/docs/crashcourse/RqData.html#rqdatacheckrq</a>
</p></div></div><div class="top"><p class="src"><a name="v:checkRqM" class="def">checkRqM</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => m a -> (a -> m (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> b)) -> m b<a href="src/Happstack-Server-RqData.html#checkRqM" class="link">Source</a></p><div class="doc"><p>like <code><a href="Happstack-Server-RqData.html#v:checkRq">checkRq</a></code> but the check function can be monadic
</p></div></div><div class="top"><p class="src"><a name="v:readRq" class="def">readRq</a><a href="src/Happstack-Server-RqData.html#readRq" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Happstack-Server-Internal-Types.html#t:FromReqURI">FromReqURI</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>name of key (only used for error reporting)
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p><code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></code> to <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Read.html#v:read">read</a></code>
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> a</td><td class="doc"><p><code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#v:Left">Left</a></code> on error, <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#v:Right">Right</a></code> on success
</p></td></tr></table></div><div class="doc"><p>use <code><a href="Happstack-Server-Internal-Types.html#v:fromReqURI">fromReqURI</a></code> to convert a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></code> to a value of type <code>a</code>
</p><pre> look "key" `checkRq` (readRq "key")
</pre><p>use with <code><a href="Happstack-Server-RqData.html#v:checkRq">checkRq</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:unsafeReadRq" class="def">unsafeReadRq</a><a href="src/Happstack-Server-RqData.html#unsafeReadRq" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Read.html#t:Read">Read</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>name of key (only used for error reporting)
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p><code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></code> to <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Read.html#v:read">read</a></code>
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> a</td><td class="doc"><p><code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#v:Left">Left</a></code> on error, <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#v:Right">Right</a></code> on success
</p></td></tr></table></div><div class="doc"><p>use <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Read.html#v:read">read</a></code> to convert a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></code> to a value of type <code>a</code>
</p><pre> look "key" `checkRq` (unsafeReadRq "key")
</pre><p>use with <code><a href="Happstack-Server-RqData.html#v:checkRq">checkRq</a></code>
</p><p>NOTE: This function is marked unsafe because some Read instances
are vulnerable to attacks that attempt to create an out of memory
condition. For example:
</p><pre> read "1e10000000000000" :: Integer
</pre><p>see also: <code><a href="Happstack-Server-RqData.html#v:readRq">readRq</a></code>
</p></div></div><h1 id="g:7">Handling POST/PUT Requests
</h1><div class="top"><p class="src"><a name="v:decodeBody" class="def">decodeBody</a> :: (<a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m, <a href="/usr/share/doc/libghc-transformers-doc/html/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Happstack-Server-Internal-Monads.html#t:FilterMonad">FilterMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m, <a href="Happstack-Server-Internal-Monads.html#t:WebMonad">WebMonad</a> <a href="Happstack-Server-Internal-Types.html#t:Response">Response</a> m) => <a href="Happstack-Server-RqData.html#t:BodyPolicy">BodyPolicy</a> -> m <a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Happstack-Server-RqData.html#decodeBody" class="link">Source</a></p><div class="doc"><p>The POST/PUT body of a Request is not received or decoded unless
this function is invoked.
</p><p>It is an error to try to use the look functions for a POST/PUT
request with out first calling this function.
</p><p>It is ok to call <code><a href="Happstack-Server-RqData.html#v:decodeBody">decodeBody</a></code> at the beginning of every request:
</p><pre> main = simpleHTTP nullConf $
do decodeBody (defaultBodyPolicy "/tmp/" 4096 4096 4096)
handlers
</pre><p>You can achieve finer granularity quotas by calling <code><a href="Happstack-Server-RqData.html#v:decodeBody">decodeBody</a></code>
with different values in different handlers.
</p><p>Only the first call to <code><a href="Happstack-Server-RqData.html#v:decodeBody">decodeBody</a></code> will have any effect. Calling
it a second time, even with different quota values, will do
nothing.
</p></div></div><h2 id="g:8">Body Policy
</h2><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:BodyPolicy" class="def">BodyPolicy</a> <a href="src/Happstack-Server-Internal-MessageWrap.html#BodyPolicy" class="link">Source</a></p><div class="doc"><p>see <code><a href="Happstack-Server-RqData.html#v:defaultBodyPolicy">defaultBodyPolicy</a></code>
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:BodyPolicy" class="def">BodyPolicy</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:inputWorker" class="def">inputWorker</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Happstack-Server-Internal-Multipart.html#t:InputWorker">InputWorker</a></dt><dd class="doc empty"> </dd><dt class="src"><a name="v:maxDisk" class="def">maxDisk</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></dt><dd class="doc"><p>maximum bytes for files uploaded in this <code><a href="Happstack-Server-Internal-Types.html#t:Request">Request</a></code>
</p></dd><dt class="src"><a name="v:maxRAM" class="def">maxRAM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></dt><dd class="doc"><p>maximum bytes for all non-file values in the <code><a href="Happstack-Server-Internal-Types.html#t:Request">Request</a></code> body
</p></dd><dt class="src"><a name="v:maxHeader" class="def">maxHeader</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></dt><dd class="doc"><p>maximum bytes of overhead for headers in <code>multipart/form-data</code>
</p></dd></dl><div class="clear"></div></div></td></tr></table></div></div><div class="top"><p class="src"><a name="v:defaultBodyPolicy" class="def">defaultBodyPolicy</a><a href="src/Happstack-Server-Internal-MessageWrap.html#defaultBodyPolicy" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:FilePath">FilePath</a></td><td class="doc"><p>temporary directory for file uploads
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></td><td class="doc"><p>maximum bytes for files uploaded in this <code><a href="Happstack-Server-Internal-Types.html#t:Request">Request</a></code>
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></td><td class="doc"><p>maximum bytes for all non-file values in the <code><a href="Happstack-Server-Internal-Types.html#t:Request">Request</a></code> body
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></td><td class="doc"><p>maximum bytes of overhead for headers in <code>multipart/form-data</code>
</p></td></tr><tr><td class="src">-> <a href="Happstack-Server-RqData.html#t:BodyPolicy">BodyPolicy</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>create a <code><a href="Happstack-Server-RqData.html#t:BodyPolicy">BodyPolicy</a></code> for use with decodeBody
</p></div></div><h1 id="g:9">RqData Monad & Error Reporting
</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:RqData" class="def">RqData</a> a <a href="src/Happstack-Server-RqData.html#RqData" class="link">Source</a></p><div class="doc"><p>An applicative functor and monad for looking up key/value pairs
in the QUERY_STRING, Request body, and cookies.
</p></div><div class="subs instances"><p id="control.i:RqData" class="caption collapser" onclick="toggleSection('i:RqData')">Instances</p><div id="section.i:RqData" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Alternative">Alternative</a> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> <a href="Happstack-Server-RqData.html#t:RqEnv">RqEnv</a> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:mapRqData" class="def">mapRqData</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>) a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>) b) -> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a> a -> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a> b<a href="src/Happstack-Server-RqData.html#mapRqData" class="link">Source</a></p><div class="doc"><p>transform the result of 'RqData a'.
</p><p>This is similar to <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fmap">fmap</a></code> except it also allows you to modify the
<code><a href="Happstack-Server-RqData.html#t:Errors">Errors</a></code> not just <code>a</code>.
</p></div></div><div class="top"><p class="src"><span class="keyword">newtype</span> <a name="t:Errors" class="def">Errors</a> a <a href="src/Happstack-Server-RqData.html#Errors" class="link">Source</a></p><div class="doc"><p>a list of errors
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Errors" class="def">Errors</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:unErrors" class="def">unErrors</a> :: [a]</dt><dd class="doc empty"> </dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:Errors" class="caption collapser" onclick="toggleSection('i:Errors')">Instances</p><div id="section.i:Errors" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> <a href="Happstack-Server-RqData.html#t:Errors">Errors</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Data.html#t:Data">Data</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Data.html#t:Data">Data</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Read.html#t:Read">Read</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Read.html#t:Read">Read</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Show.html#t:Show">Show</a> a => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Show.html#t:Show">Show</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Error-Class.html#t:Error">Error</a> (<a href="Happstack-Server-RqData.html#t:Errors">Errors</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>)</td><td class="doc empty"> </td></tr></table></div></div></div><h2 id="g:10">Using RqData with ServerMonad
</h2><div class="top"><p class="src"><a name="v:getDataFn" class="def">getDataFn</a><a href="src/Happstack-Server-RqData.html#getDataFn" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a> m)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a> a</td><td class="doc"><p><code><a href="Happstack-Server-RqData.html#t:RqData">RqData</a></code> monad to evaluate
</p></td></tr><tr><td class="src">-> m (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> [<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>] a)</td><td class="doc"><p>return <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#v:Left">Left</a></code> errors or <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#v:Right">Right</a></code> a
</p></td></tr></table></div><div class="doc"><p>run <code><a href="Happstack-Server-RqData.html#t:RqData">RqData</a></code> in a <code><a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a></code>.
</p><p>Example: a simple <code>GET</code> or <code>POST</code> variable based authentication
guard. It handles the request with <code>errorHandler</code> if
authentication fails.
</p><pre> data AuthCredentials = AuthCredentials { username :: String, password :: String }
isValid :: AuthCredentials -> Bool
isValid = const True
myRqData :: RqData AuthCredentials
myRqData = do
username <- look "username"
password <- look "password"
return (AuthCredentials username password)
checkAuth :: (String -> ServerPart Response) -> ServerPart Response
checkAuth errorHandler = do
d <- getDataFn myRqData
case d of
(Left e) -> errorHandler (unlines e)
(Right a) | isValid a -> mzero
(Right a) | otherwise -> errorHandler "invalid"
</pre><p>NOTE: you must call <code><a href="Happstack-Server-RqData.html#v:decodeBody">decodeBody</a></code> prior to calling this function if
the request method is POST or PUT.
</p></div></div><div class="top"><p class="src"><a name="v:withDataFn" class="def">withDataFn</a> :: (<a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m, <a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a> m) => <a href="Happstack-Server-RqData.html#t:RqData">RqData</a> a -> (a -> m r) -> m r<a href="src/Happstack-Server-RqData.html#withDataFn" class="link">Source</a></p><div class="doc"><p>similar to <code><a href="Happstack-Server-RqData.html#v:getDataFn">getDataFn</a></code>, except it calls a sub-handler on success
or <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:mzero">mzero</a></code> on failure.
</p><p>NOTE: you must call <code><a href="Happstack-Server-RqData.html#v:decodeBody">decodeBody</a></code> prior to calling this function if
the request method is POST or PUT.
</p></div></div><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:FromData" class="def">FromData</a> a <span class="keyword">where</span><a href="src/Happstack-Server-RqData.html#FromData" class="link">Source</a></p><div class="doc"><p>Used by <code><a href="Happstack-Server-RqData.html#v:withData">withData</a></code> and <code><a href="Happstack-Server-RqData.html#v:getData">getData</a></code>. Make your preferred data
type an instance of <code><a href="Happstack-Server-RqData.html#t:FromData">FromData</a></code> to use those functions.
</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:fromData" class="def">fromData</a> :: <a href="Happstack-Server-RqData.html#t:RqData">RqData</a> a<a href="src/Happstack-Server-RqData.html#fromData" class="link">Source</a></p></div><div class="subs instances"><p id="control.i:FromData" class="caption collapser" onclick="toggleSection('i:FromData')">Instances</p><div id="section.i:FromData" class="show"><table><tr><td class="src"><a href="Happstack-Server-RqData.html#t:FromData">FromData</a> a => <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Happstack-Server-RqData.html#t:FromData">FromData</a> a, <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> b) => <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> (a, b)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Happstack-Server-RqData.html#t:FromData">FromData</a> a, <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> b, <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> c) => <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> (a, b, c)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Happstack-Server-RqData.html#t:FromData">FromData</a> a, <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> b, <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> c, <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> d) => <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> (a, b, c, d)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:getData" class="def">getData</a> :: (<a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a> m, <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> a) => m (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> [<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>] a)<a href="src/Happstack-Server-RqData.html#getData" class="link">Source</a></p><div class="doc"><p>A variant of <code><a href="Happstack-Server-RqData.html#v:getDataFn">getDataFn</a></code> that uses <code><a href="Happstack-Server-RqData.html#t:FromData">FromData</a></code> to chose your
<code><a href="Happstack-Server-RqData.html#t:RqData">RqData</a></code> for you. The example from <code><a href="Happstack-Server-RqData.html#v:getData">getData</a></code> becomes:
</p><pre> data AuthCredentials = AuthCredentials { username :: String, password :: String }
isValid :: AuthCredentials -> Bool
isValid = const True
myRqData :: RqData AuthCredentials
myRqData = do
username <- look "username"
password <- look "password"
return (AuthCredentials username password)
instance FromData AuthCredentials where
fromData = myRqData
checkAuth :: (String -> ServerPart Response) -> ServerPart Response
checkAuth errorHandler = do
d <- getData
case d of
(Left e) -> errorHandler (unlines e)
(Right a) | isValid a -> mzero
(Right a) | otherwise -> errorHandler "invalid"
</pre><p>NOTE: you must call <code><a href="Happstack-Server-RqData.html#v:decodeBody">decodeBody</a></code> prior to calling this function if
the request method is POST or PUT.
</p></div></div><div class="top"><p class="src"><a name="v:withData" class="def">withData</a> :: (<a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="Happstack-Server-RqData.html#t:FromData">FromData</a> a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m, <a href="Happstack-Server-Internal-Monads.html#t:ServerMonad">ServerMonad</a> m) => (a -> m r) -> m r<a href="src/Happstack-Server-RqData.html#withData" class="link">Source</a></p><div class="doc"><p>similar to <code><a href="Happstack-Server-RqData.html#v:getData">getData</a></code> except it calls a subhandler on success or <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:mzero">mzero</a></code> on failure.
</p><p>NOTE: you must call <code><a href="Happstack-Server-RqData.html#v:decodeBody">decodeBody</a></code> prior to calling this function if
the request method is POST or PUT.
</p></div></div><h1 id="g:11">HasRqData class
</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:RqEnv" class="def">RqEnv</a> = ([(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>, <a href="Happstack-Server-Internal-Types.html#t:Input">Input</a>)], <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> [(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>, <a href="Happstack-Server-Internal-Types.html#t:Input">Input</a>)], [(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a>, <a href="Happstack-Server-Internal-Cookie.html#t:Cookie">Cookie</a>)])<a href="src/Happstack-Server-RqData.html#RqEnv" class="link">Source</a></p><div class="doc"><p>the environment used to lookup query parameters. It consists of
the triple: (query string inputs, body inputs, cookie inputs)
</p></div></div><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:HasRqData" class="def">HasRqData</a> m <span class="keyword">where</span><a href="src/Happstack-Server-RqData.html#HasRqData" class="link">Source</a></p><div class="doc"><p>A class for monads which contain a <code><a href="Happstack-Server-RqData.html#t:RqEnv">RqEnv</a></code>
</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:askRqEnv" class="def">askRqEnv</a> :: m <a href="Happstack-Server-RqData.html#t:RqEnv">RqEnv</a><a href="src/Happstack-Server-RqData.html#askRqEnv" class="link">Source</a></p><p class="src"><a name="v:localRqEnv" class="def">localRqEnv</a> :: (<a href="Happstack-Server-RqData.html#t:RqEnv">RqEnv</a> -> <a href="Happstack-Server-RqData.html#t:RqEnv">RqEnv</a>) -> m a -> m a<a href="src/Happstack-Server-RqData.html#localRqEnv" class="link">Source</a></p><p class="src"><a name="v:rqDataError" class="def">rqDataError</a> :: <a href="Happstack-Server-RqData.html#t:Errors">Errors</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> m a<a href="src/Happstack-Server-RqData.html#rqDataError" class="link">Source</a></p><div class="doc"><p>lift some <code><a href="Happstack-Server-RqData.html#t:Errors">Errors</a></code> into <code><a href="Happstack-Server-RqData.html#t:RqData">RqData</a></code>
</p></div></div><div class="subs instances"><p id="control.i:HasRqData" class="caption collapser" onclick="toggleSection('i:HasRqData')">Instances</p><div id="section.i:HasRqData" class="show"><table><tr><td class="src"><a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> <a href="Happstack-Server-RqData.html#t:RqData">RqData</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/libghc-transformers-doc/html/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> (<a href="Happstack-Server-Internal-Monads.html#t:ServerPartT">ServerPartT</a> m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> (<a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m) => <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> (<a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Lazy.html#t:StateT">StateT</a> s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> (<a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Writer-Lazy.html#t:WriterT">WriterT</a> w m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Happstack-Server-RqData.html#t:HasRqData">HasRqData</a> (<a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.10.0</p></div></body></html>
|