[converted happstack.com to be a happstack application Jeremy Shaw **20091107190148 Ignore-this: 1fd5bc698a04984af22f94f739921ec ] addfile ./Main.hs addfile ./Setup.hs addfile ./happstack.com.cabal adddir ./irc-logs adddir ./theme addfile ./theme/default.css adddir ./theme/images addfile ./theme/images/bodybg.png addfile ./theme/images/contbg.png addfile ./theme/images/footerbg.png addfile ./theme/images/gradient1.png addfile ./theme/images/gradient2.png hunk ./Main.hs 1 - +{-# LANGUAGE FlexibleContexts, TypeFamilies #-} +{-# OPTIONS_GHC -F -pgmFtrhsx #-} +module Main where + +import Control.Applicative +import Control.Monad +import Control.Monad.Trans(MonadIO(liftIO)) +import Data.List (filter, sort) +import Happstack.Server +import Happstack.Server.HSP.HTML +import HSP.Google.Analytics(UACCT(UACCT), analytics) +import HSP +import HSP.ServerPartT () +import qualified HSX.XMLGenerator as HSX +import System.Directory (getDirectoryContents) +import System.FilePath + +main :: IO () +main = simpleHTTP nullConf impl + +impl :: ServerPartT IO Response +impl = + msum [ dir "theme" $ fileServe [] "theme" + , dir "docs" $ fileServe [] "docs" + , dir "irc-logs" $ msum [ do methodM GET ; (ok . toResponse) =<< (unXMLGenT ircLogs) + , fileServe [] "irc-logs" + ] + , dir "index.html" $ (ok . toResponse) =<< (unXMLGenT home) + , dir "download.html" $ (ok . toResponse) =<< (unXMLGenT download) + , dir "faq.html" $ (ok . toResponse) =<< (unXMLGenT faq) + , dir "develop.html" $ (ok . toResponse) =<< (unXMLGenT develop) + , dir "tutorials.html" $ (ok . toResponse) =<< (unXMLGenT tutorials) + , methodM GET >> seeOther "/index.html" (toResponse "index.html") + ] + +appTemplate :: + ( XMLGenerator m + , EmbedAsChild m String + , EmbedAsChild m () + , EmbedAsChild m headers + , EmbedAsChild m body + ) => String -> headers -> body -> XMLGenT m (HSX.XML m) +appTemplate title headers body = + + + + + <% title %> + <% headers %> + + + <% top %> + <% body %> + <% footer %> + <% analytics (UACCT "UA-7111625-1") %> + + + +top :: (XMLGenerator m) => XMLGenT m (HSX.XML m) +top = +
+ +
+ +sidebar :: (XMLGenerator m) => XMLGenT m (HSX.XML m) +sidebar = + + +home :: (XMLGenerator m, EmbedAsChild m XML, EmbedAsChild m ()) => XMLGenT m (HSX.XML m) +home = + appTemplate "Happstack - Haskell application server stack" () $ + container

... a refreshingly innovative web application + server written in Haskell. Leveraging the MACID state system, + Happstack offers robust and scalable data access without the + headache of managing a traditional RDBMS such as MySQL.

+ "The Happstack project needs you!" +
+

Happstackers, coders, bug-hunters, and enthusiasts alike: We need your help. To get involved, please get on the google group or #happs on irc.freenode.net and offer your services there.

+

For the latest news, events, and updates on the project be sure to check the project blog frequently.

+
+ +download :: (XMLGenerator m, EmbedAsChild m XML, EmbedAsChild m ()) => XMLGenT m (HSX.XML m) +download = + appTemplate "Happstack - Download Happstack" () $ + container

download Happstack tarballs for your computer. If you have cabal-install then this will be even easier.

+ "Download Happstack" +
+

ghc 6.8.3 or 6.10.1, and cabal >= 1.6 are required.

+

Cabal Packages on Hackage

+

happstack-util, happstack-data, happstack-state, happstack-ixset, happstack-server, happstack.

+

How to install without cabal-install

+
    +
  1. extract each tarball with a command like: tar -xvzf mypackage.tar.gz
  2. +
  3. cd mypackage
  4. +
  5. runhaskell Setup.hs configure
  6. +
  7. runhaskell Setup.hs build
  8. +
  9. runhaskell Setup.hs install
  10. +
+

How to install with cabal-install

+
    +
  1. cabal update
  2. +
  3. cabal install happstack
  4. +
+
+ +faq :: (XMLGenerator m, EmbedAsChild m XML, EmbedAsChild m ()) => XMLGenT m (HSX.XML m) +faq = + appTemplate "Happstack - Frequently Asked Questions" () $ + container

Here you will find answers to frequently asked questions about Happstack and HAppS. It both exhilarating and informative!

+ "Frequently Asked Questions" +
+ +

Happstack is a fork of HAppS.

+

Why did you fork HAppS?

+

There are multiple reasons that basically boil down to:

+ +

Is HAppS really orphaned?

+

Yes, see http://groups.google.com/group/HAppS/msg/d128331e213c1031

+

Why hasn't Alex Jacobson made a statement regarding the project being orphaned?

+

I don't know. If you want to ask him yourself contact me in private and I will give you his phone number.

+ +

Where is the new repository?

+

http://patch-tag.com/repo/mae/happstack/home

+ +

How is the new repository structured?

+

The old HAppS project had each module split into a separate darcs-1 repository. The new repository combines all these packages into one darcs-2 repository.

+ +

Why did you put all the packages in one repository?

+

There are multiple reasons. To name a few:

+ + +

Where is all the repository history?

+

The history for HAppS is in the old darcs1 repositories, I retained the patch context when I created the new repository, so we can always go back if we really need to.

+ +

Can I have commit access?

+

Yes and no. Yes you may pull the repository and create your own spontaneous branch. Yes you may submit your changes to the mailing list. Yes we will accept quality work. No we will probably not give most people access to the root repository - but rest assured, there will be several people to share the keys should one of us get hit by a bus.

+ +

What are the project goals of happstack?

+

To improve the existing codebase of HAppS without drastically changing its original function. Namely we want to prune dead code, improve test coverage, and increase the existing documentation.

+ +

How do you pronounce Happstack? What does it stand for?

+

Happstack is pronounced HAPP-STACK. It is short for "Haskell Application Server Stack".

+
+ + +develop :: (XMLGenerator m, EmbedAsChild m XML, EmbedAsChild m ()) => XMLGenT m (HSX.XML m) +develop = + appTemplate "Happstack - Help develop Happstack" () $ + container

Think your ready to dive in and start developing Happstack? You'll need darcs2 installed to get our development branch. Grab your caffeine and let's get started!

+ "Help develop Happstack" +
+

Get involved

+

If you are interested in helping the project out, please offer your services on the google group or #happs on irc.freenode.net.

+

How to get the code

+

You will need darcs2 to get the development code.

+

Development Branch

+

darcs get --lazy http://patch-tag.com/r/mae/happstack/pullrepo happstack

+

Stable Branch

+

darcs get --lazy http://patch-tag.com/r/mae/happstack-stable/pullrepo happstack

+ {- +

Build Bot

+

Automated builds are available via our buildbot.

+ -} +

Patches

+

Patches can be sent to happs@googlegroups.com or attached to the relevant issue.

+ +
+ +tutorials :: (XMLGenerator m, EmbedAsChild m XML, EmbedAsChild m ()) => XMLGenT m (HSX.XML m) +tutorials = + appTemplate "Happstack - Tutorials" () $ + container

Happstack tutorials from around the land. Here you will find a semi-definitive list. Happy hacking!

+ "Tutorials" +
+ +
+ +ircLogs :: (XMLGenerator m, EmbedAsChild m XML, EmbedAsChild m (), MonadIO m) => XMLGenT m (HSX.XML m) +ircLogs = + do logFiles <- liftIO $ (sort . filter ((== ) ".html" . takeExtension)) <$> getDirectoryContents "irc-logs" + appTemplate "Happstack - IRC Logs" () $ + container

Logs from #happs on irc.freenode.net

+ "#happs IRC Logs" + + + +container :: + ( XMLGenerator m + , EmbedAsChild m intro + , EmbedAsChild m content + , EmbedAsChild m XML + ) => intro -> String -> content -> XMLGenT m (HSX.XML m) +container intro heading content = +
+
+ + + +
+ <% intro %> +
+
+

<% heading %>

+ <% content %> +
+ <% sidebar %> +
<% cdata " " %>
+
+ + +footer :: (XMLGenerator m) => XMLGenT m (HSX.XML m) +footer = + + +{- + + + + + + + Happstack - Haskell application server stack + + + +
+ +

Skip to: Site menu | Main content

+
+ +
+
+ + + +
+

... a refreshingly innovative web application server written in Haskell. Leveraging the MACID state system, Happstack offers robust and scalable data access without the headache of managing a traditional RDBMS such as MySQL.

+
+
+

The Happstack project needs you!

+ +

Happstackers, coders, bug-hunters, and enthusiasts alike: We need your help. To get involved, please get on the google group or #happs on irc.freenode.net and offer your services there.

+ +

For the latest news, events, and updates on the project be sure to check the project blog frequently.

+
+ + +
 
+
+ + + + + + + + +-} hunk ./Setup.hs 1 +#!/usr/bin/env runghc + +module Main where + +import Distribution.Simple +import Distribution.Simple.Program +import System.Cmd + +trhsxProgram = simpleProgram "trhsx" + +main :: IO () +main = defaultMainWithHooks simpleUserHooks { + hookedPrograms = [trhsxProgram] + } hunk ./happstack.com.cabal 1 +Name: happstackDotCom +Version: 0.0.1 +License: BSD3 +Author: jeremy@seereason.com +Maintainer: partners@seereason.com +Synopsis: happstack.com +Description: The source for happstack.com +Build-Type: Custom +Category: Web, Language +Cabal-version: >= 1.6 + +Executable happstack.com-server + Main-Is: Main.hs + GHC-options: -threaded -Wall -Wwarn -O2 -fno-warn-name-shadowing -fno-warn-missing-signatures -fwarn-tabs -fno-warn-unused-binds -fno-warn-orphans -fwarn-unused-imports + Build-Tools: trhsx + Build-Depends: base, + happstack-extra >= 0.71, + happstack-server, + mtl, + hsx, + hsp, + happstack, + filepath, + directory + hunk ./theme/default.css 1 +/* andreas03 - an open source xhtml/css website layout by Andreas Viklund - http://andreasviklund.com . Free to use for any purpose as long as the proper credits are given to the original author. + +Version: 1.2 +(Nov 28, 2005) + +Screen layout: */ + +body{ +margin:0; +padding:30px 0; +font:76% tahoma,verdana,sans-serif; +background:#047 url(images/bodybg.png) repeat-x fixed; +color:#222; +} + +#thetop{ +margin:0; +} + +#container{ +width:720px; +margin:0 auto; +padding:20px 20px 0 20px; +background:#fff url(images/contbg.png) no-repeat; +color:#222; +} + +a{ +text-decoration:none; +background-color:inherit; +color:#26c; +} + +a:hover { +text-decoration:underline; +} + +a img{ +border:0; +} + +p{ +margin:0 0 15px 0; +line-height:1.5em; +} + +#main p,#sidebar p{ +padding:0 0 0 10px; +} + +#logo{ +float:left; +width:240px; +margin:0 20px 0 0; +padding:0 0 25px 0; +background:#eee; +border:4px solid #dde; +text-align:center; +color:#555; +overflow:auto; +} + +#logo h1{ +margin:50px 5px 1px 5px; +letter-spacing:-3px; +} + +#logo a{ +background-color:inherit; +color:#26a; +text-decoration:none; +} + +#logo a:hover{ +background-color:inherit; +color:#69e; +} + +#tagline{ +text-align:center; +font-size:1.2em; +} + + + +#intro p{ +line-height:1.5em; +} + +#main{ +float:left; +width:530px; +margin-right:20px; +padding:0; +} + +#main h2 { +display:block; +margin:30px 0 10px 0; +padding:5px 0 5px 8px; +background:#eee url(images/gradient2.png) repeat-x; +color:#222; +border-top:1px solid #ddd; +border-right:1px solid #bbb; +border-bottom:1px solid #bbb; +border-left:1px solid #ddd; +text-decoration:none; +} + +#sidebar{ +width:155px; +float:right; +margin-top:20px; +font-size:1em; +line-height:1.3em; +} + +#sidebar p, #sidebar .linklist { +font-size:0.9em; +} + +#sidebar ul.linklist { +list-style-type: none; +margin: 0px; +padding: 5px 0px 5px 8px; +} + +#sidebar #menu ul { +list-style-type: none; +margin: 0px; +padding: 0px; +} + +#sidebar #menu li a, #sidebar #menu li span, .sidelink{ +display:block; +width:140px; +margin:3px 10px 2px 0; +padding:5px 0 5px 8px; +font-size:1.1em; +font-weight:bold; +text-align:left; +background:#eee url(images/gradient1.png) repeat-x; +color:#26c; +border-top:1px solid #ddd; +border-right:1px solid #bbb; +border-bottom:1px solid #bbb; +border-left:1px solid #ddd; +} + +#sidebar #menu li a:hover, +#sidebar #menu li.webgen-menu-item-selected a, +#sidebar #menu li.webgen-menu-item-selected span, +.sidelink:hover, .menuheader +{ +background:#fff url(images/gradient2.png) repeat-x; +color:#222; +border-top:1px solid #ddd; +border-right:1px solid #888; +border-bottom:1px solid #888; +border-left:1px solid #ddd; +text-decoration:none; +} + +#footer{ +margin:0 auto 20px auto; +width:760px; +background:#fff url(images/footerbg.png) bottom left no-repeat; +padding:0 0 5px 0; +font-size:0.9em; +color:#888; +text-align:center; +} + +h1,h2,h3,h4{ +margin:0 0 10px 0; +font-weight:normal; +} + +h1{ +font-size:2.8em; +} + +h2{ +margin:0 0 4px 0; +font-size:1.8em; +} + +h3{ +margin:20px 0 8px 0; +font-size:1.4em; +} + +h4{ +margin:10px 0 5px 0; +font-size:1.2em; +} + +.clear{ +clear:both; +margin:0; +} + +.right{ +text-align:right; +} + +.internallink{ +font-size:0.9em; +text-align:center; +} + +.block{ +padding:20px; +background:#eee; +color:#222; +border:2px solid #ddd; +} + +.credit{ +color:#888; +background-color:inherit; +} + +.hide{ +display:none; +} + +code { + font-size: 12px; + padding:0; + margin:0; + color: #222; + font-family: courier, monospace; + + overflow: auto; +} + + +/* Original open source design by Andreas Viklund - http://andreasviklund.com +Released through OSWD.org */ binary ./theme/images/bodybg.png oldhex * newhex *89504e470d0a1a0a0000000d4948445200000001000005dc08020000006cef7388000000046741 *4d410000afc837058ae90000001974455874536f6674776172650041646f626520496d61676552 *6561647971c9653c000001934944415478daec564192c3300843fba5fd53ffff03edb6691c1983 *4d7ae8c907a67582311642c4ecf7f1636635c3bff15ce3589b3ee3e8d3ede5b58f76edef0c479c *e1bfcb41cf863bcbe8d64f1f5cbe671e67ecd73bcaefd307497e092608ce7f3d7f9fd1e231898d *c3970e670418f0ed7bde71a80b9d5f94a3e204595b5cc3863725770478380c8d7207c4b5b1ecae *0ed3ac260878d0b04791df9aabe796af9372a8784ec757f4bd30cba5f1407a62c8cbf1c1bf4f7b *cdf598f2bec32fe9c38c03537c833dda43b45a1d945f2b4df15aa15c9962a33dc3b93fa4df8800 *a70567577958a0bb77f0cef806a72bcabb59af0db17c0f043a44c731dda33da1ba5ce97bad5375 *ae747b57fa2e75c52caeef09d6eaa535026ecc63acf3b66c9e459a15607fabbf67784e668cd6ce *b25e0ff8d7e53a9ba75e4b16f71ae61fe378b39e85ccff8837f41aca7cee92a3c6a7fccb6ac882 *ceb8582b6d8ae650344bda77c3071caf6a1f59d7c6a635367e93c08a58259aa8b32bddefbf0f51 *9cd5eebe1fe3b86ddbb66ddbb66ddbb66ddbb62fd89f0003001151c4b6fe4152d3000000004945 *4e44ae426082 binary ./theme/images/contbg.png oldhex * newhex *89504e470d0a1a0a0000000d49484452000002f8000000c8080200000012a50230000000046741 *4d410000afc837058ae90000001974455874536f6674776172650041646f626520496d61676552 *6561647971c9653c000007b64944415478daecddcd8b56551cc0f167ee336feda498b2cc9c8520 *a4c55031100ca4241404e2804820481114819b14a245b8a8856d02a13f4068d1225cb977e14203 *0913c36808c20917da3f1011ceed716e733b3e2fe3db3333f7fce6f3593cdc7966568781f3e59c *73ef1d69bdfa512bd12e8a036fbc7ce8cd5776edd83ab3ebf9ce8f2d00189e3b4b4b57176e2e2c *de3a7bfecab90bd73a3f1a13d6ce481a3abb763cf3ed17efcfee9e362e00ac83cbd76f1c3d7966 *61f1b6a1608db45bcfbd565d1d3fb2fffbaf3e9c7ef6298302c0fad8f6f4960f0ecefdf5f73f3f *fcfcbbd1600d43e7d4b1835f7e7c606cb46d4400584f9da9e7add75f9c1c1f3d7ff957a3c19a84 *cefcbe996f3e7dd75800b051e66676fef8cbe26f7ffc692818ae627c6cf4f489c30602808dd599 *8c3a53927160c8a133bf6fe685ad4f1a080036d6ceed539d29c93830ecd0d9ebbf0a8046302531 *fcd099dd336d140068025312c30f9d6d535b8c02004d604a62f8a1e3e417000d614a62f8a16308 *0000a1030020740000840e0080d00100103a0000420700d80c46cab2340a0034c4c58b17c7564c *4e4e4e4c4c742ec6c7c73b9fa3a3a3ed76bb587677021b19f96f265bb96073bab3b47475e1e6c2 *e2adb3e7af9cbb70adf3a3d001a0a12e5dba54354d27713a7d537d56dd2374b8afcbd76f1c3d79 *6661f176fd8dad2b009a6564451d3495aebf5139f49add3dfdd3779f1f3fb25fe800d0d0ca492f *daed76553c7d73077a3d3131f6f527874e1d3b2874006862e8a46b39ab9410ace2b3f7de7e67ee *25a10340a38ba78e1e89c3c33a7de2f0f8d8a8d001a0597dd377a3cad6150f6be7f6a9f97d3342 *078026e64ed534e967fa5b43c48398df2b74006864e274558edbac7804b37ba6850e008d6b9d74 *f76a951d2bd1c3eab64d6d113a0034ab72d227d9aeb28105f7e53032004d6c9d56cf5e95d6e1d1 *081d009a553975d3f4668dd71621740088903b77a7a8e41510e9f7207400c835716a65597a5a20 *42078080add3a99cbec77440e80090b1ea204e7587795a3f5a07a10340f67adffc30e8b7207400 *88903bf5757de395e241e8009071e5d429d3fb0841103a0064382d15ff4f4cf579647183d00120 *5aeba81c840e0080d001201f5671103a0084559d3e963b081d0042e9fb46cfbe2ff804a10340c6 *c553df555e2e3326081d00f2566f5a55f796a70c0e42078068d1d3726407a103400c7ddffc505d *d8bd42e80010b07840e800207740e800d060f519e4d6bd375e891e840e00d9ab8fe374550e081d *00e248977640e80000081d001a2f5dcbb1a883d001204ee2f4bd06a10340f6d203c80e23237400 *08c5a615420780cd923b5a07a10340a069a928c40d420780e0e40e420780c895e3b00e42078080 *9553331a081d00a2558eee41e8001050d7b373d2bef1581d840e00794b176f3a9f4551a4bf323e *081d00729e9656caa6bab08a83d00120946a45a74a9c41ab385677103a0064a99338d5a6556fcd *e81b840e0099cf4c2bbb57f5491d7d83d0012048e5a4cb39839e19e8ec0e420780fc74dd756540 *103a00440b9df422bdc33cfd336385d00120d7d6491775640d42078010d3d2f2e91caf7d40e800 *10501537bdf7962b1e840e004142278d1b8983d001205aebd49553df493ee85673103a0064322d *254f0b1cf4c0400fd141e80090a50739836c4507a10340f6ade3de2b840e00b1a625b797237400 *886a50e2281e840e00715a47dc20740008372dddfbde72bb57081d0042e98a9bae9bc9750f4207 *808c2ba795bc0842d920740008153a69d9b8f70aa10340f0dc49bf3738081d00b24f1cef7940e8 *0010b6752cde2074000858395d1720740008983bd675103a00044c9c8a633a081d003645f480d0 *01207b5671103a0084b5ca7bcb2df020740088c61a0f42070040e80090091b55081d00c2f64d59 *965dad630f0ba1034094f9a9304321740008a7baf16a6969a96b51c76616420780ec2ba75c5614 *4575ad6f103a000451954ddfb8714607a10340de063d2db065eb0aa103002074006828cb36081d *0082b78e333a081d0000a1034056aae51c7b58081d0062564eabdf4695f441e80000081d001aa9 *deb7b27e83d001207ef480d00140df80d00100840e0080d00180611a740cd97e16420780289353 *51b8f10aa103403483e2c68bae103a00446b1d8b3a081d006256ce837c0f420780ec4307840e00 *415a47ee20740008ab2c4bad83d00120269583d00140e280d00120abd0e96d1df583d0012054eb *a471e36981081d0022a78f4140e80010aa69ea6b2b3a081d0002b6cea06f40e80010a17240e800 *207740e8000042070036665a2a0acb39081d0022d33a081d00b40e081d0072ee1bc583d0010010 *3a00349e251c840e002a07840e005a07a10300a207a10300fa06a103008fad2c4b8380d0012008 *6b39081d00740f081d00940d420700b40e42070040e80000081d0018c41e1642070040e8000042 *07003690ed2a840e0080d00100840e0080d00100103a00f0789c4a46e800105659960601a10340 *4c5674103a0000420700103a00d010cee820740008cb191d840e002a07840e002a87cdf9ef6413 *140088ca8a0e0020740000840e0080d00100103a000042070040e8000042070040e80000081d00 *00a1030020740000840e0020740000840e0080d00100103a000042070040e8000042070040e800 *00081d0000a1030020740000840e0080d00100840e0080d00100103a0000ebe25f01060090c618 *398cc2792c0000000049454e44ae426082 binary ./theme/images/footerbg.png oldhex * newhex *89504e470d0a1a0a0000000d49484452000002f80000000b080200000085d96e2a000000046741 *4d410000afc837058ae90000001974455874536f6674776172650041646f626520496d61676552 *6561647971c9653c0000010b4944415478daecdbad4a04511cc6e19963378b08c6ad22780526a3 *b0d760b77a01de80c9a2c1240adb0cc282c960585630b8cd4f14fc60d1a0e8ee8c7f58d8b057e0 *1e9e27cd3933e94dbf32655dd70500408ed2cfefc00a00407e2272d2e34bdf1000407e2272d2c5 *d58d210080fc44e4a4d659d71000407e2272d2e1ebf0fcfade1600404e226f2272525196cd9d93 *cabf5700402e226c226f2272521c9e06e5daf691d60100f2a89c089bc89b784ea3abd3bbfecad6 *c1dbe797750080e9153113491361333aa6f18bcefbf7fce6fe5efbd24600c0348a8c899889a419 *df94c5c6eec447ebb3557375b9b138b7d4589849c96a00c0bf35acaa6eefa177fb7cdceeb43e26 *bbe54f800100652c617b780e034f0000000049454e44ae426082 binary ./theme/images/gradient1.png oldhex * newhex *89504e470d0a1a0a0000000d4948445200000001000000640802000000c84ecd37000000046741 *4d410000afc837058ae90000001974455874536f6674776172650041646f626520496d61676552 *6561647971c9653c000000494944415478dad48c510ac030084393f4fe47b42711bab80afd2efb *1af23086981131052c8114016bc8d278c35e4d6ddf28cd8dde0c3bdf7efdf364d07db764e6eed7 *b79e1ff2083000643307943209850d0000000049454e44ae426082 binary ./theme/images/gradient2.png oldhex * newhex *89504e470d0a1a0a0000000d4948445200000001000000640802000000c84ecd37000000046741 *4d410000afc837058ae90000001974455874536f6674776172650041646f626520496d61676552 *6561647971c9653c0000004b4944415478daecc3c911c0200c00b1edbf580ce6be4c480b794733 *4244102738e710790bdedf211054d1a8a498c829534aa1d64a6b8dd13b630ee69cacb5d9fb36c3 *8e71cef97ffb0830000c412880ca9166260000000049454e44ae426082