packages feed

happs-tutorial 0.9.0 → 0.9.1

raw patch · 2 files changed

+3/−29 lines, 2 filesdep ~HStringTemplateHelpers

Dependency ranges changed: HStringTemplateHelpers

Files

happs-tutorial.cabal view
@@ -1,15 +1,12 @@ Name:                happs-tutorial-Version:             0.9.0+Version:             0.9.1 Synopsis:            A Happstack Tutorial that is its own web 2.0-type demo.  Description:         A nice way to learn how to build web sites with Happstack- License:             BSD3 License-file:        LICENSE Author:              Thomas Hartman, Eelco Lempsink, Creighton Hogg- Maintainer:          Creighton Hogg <wchogg at gmail.com> Copyright:           2008 Thomas Hartman, 2009 Thomas Hartman & Creighton Hogg- Stability:           Experimental Category:            Web Build-type:          Simple@@ -46,10 +43,10 @@         MiscMap         ControllerStressTests         View-    ghc-options: -Wall -O2+    ghc-options: -Wall     Build-Depends:   base                      , HStringTemplate >= 0.4.0 && < 0.5.0-                     , HStringTemplateHelpers > 0.0.0 && < 1.0.0+                     , HStringTemplateHelpers >= 0.0.11 && < 1.0.0                      , mtl >= 1.1.0.0 && < 2.0.0.0                       , bytestring >= 0.9.0.0 && < 0.10.0.0                      , happstack >= 0.3 && < 0.4
− templates/formsanddata.st
@@ -1,23 +0,0 @@-<h3>GET, POST, and FromData</h3>-<p>We've covered how to serve basic HTML with Happstack, in a number of different ways.  What we haven't yet covered-is what to do with form data.  In principle, you could dig into the request and try to pull out the parameters.  That's-not the Happstack way, though.</p>-<p>Instead, you can use the type class FromData and the functions getData and withData.-A simple example can be found in <a href=/src/GetExample.hs>GetExample.hs<a/>.  This example uses HSP to build-the forms, for simple convenience.</p>-<p>ghci>:i FromData-<br/>class FromData a where fromData :: RqData a-<br/>        -- Defined in Happstack.Server.SimpleHTTP-<br/>instance [overlap ok] (FromData a, FromData b) => FromData (a, b)-<br/>  -- Defined in Happstack.Server.SimpleHTTP-<br/>instance [overlap ok] (FromData a, FromData b, FromData c) => FromData (a, b, c)-<br/>  -- Defined in Happstack.Server.SimpleHTTP-<br/>instance [overlap ok] (FromData a,FromData b,FromData c,FromData d) => FromData (a, b, c, d)-<br/>  -- Defined in Happstack.Server.SimpleHTTP-<br/>instance [overlap ok] (FromData a) => FromData (Maybe a)-<br/>  -- Defined in Happstack.Server.SimpleHTTP-</p>-<p>An important note about RqData is that it is a Monad and a MonadPlus, so between this type class machinery and-the helper function look, you should be able to define your own instances of FromData for your own types.-Again, the simple example up above should provide some guidance for this.</p>-<p>Next we cover <a href="/tutorial/file-uploads">uploading files</a></p>