[wording thomashartman1@gmail.com**20081223040328] hunk ./templates/gettingstarted.st 3 -

If you use Ruby on Rails, Django, Perl Catalyst, PHP, or some other popular web framework, but -have programmed in haskell and would like to use the world's greatest language for your next web project, -just keep reading. I promise by the time you're done you will give you all the knowledge you need.

- -

This tutorial is its own demo, and it is open source. -We will build a job board, which you can try out for yourself by -creating a user on this demo site, and play with locally after you have installed the source code. -The text you are reading this moment is bundled up too, hence "self-demoing tutorial." -For best results, you should -install and run -it in a local environment where you have control. Then, when you are done -learning, you can use the tutorial code as a starting point for your own -HAppS applications. -

hunk ./templates/home.st 1 -

Real World HAppS

- -$!

Haskell is a great way to program.

!$ +

Real World HAppS: building a Web 2.0 App with haskell~~

hunk ./templates/home.st 8 -$!

You also get all the goodness -that comes from programming in haskell, my favorite language.

-!$ - -

HAppS is especially great if you believe, like I do, that as -modern software systems tend toward ever increasing complexity, -database usage is an unnecessary source of complication that -should be factored out where possible. - -

Ruby's rails and python's django have become popular largely because of their object relational mapping systems, -which hide the complexity of database engines by converting application data manipulation logic into sql. -When I first used an ORM, it felt like a huge improvement over writing sql statements every time I wanted to manipulate -an application's state. But pretty soon ORMs started seeming hackish to me too. At some point, -the metaphors I wanted to use just broke down. - - -$!Or to put it another way, that sql -is an ugly hack. !$ -

HAppS is haskell's answer to rails and django (and perl's catalyst, - and php). - $! , and every ORM ever written in the history of software) !$ - With HAppS, there is no wrangling data - structures into and out of the database, because there is no database. You use whatever data - structures are natural to your application, and serialize them - transparently using - powerful - machinery that's running behind the - scenes. And if there are existing databases that you need to connect to, you can do that too - -- you're not locked in to using macid for everything. - -

MACID, -the HAppS storage mechanism, is no vanilla serialization layer that will -start acting in weird ways when an application has many concurrent users doing possibly conflicting things. -By leveraging haskell's type system -(see composable memory transactions paper), -you get the same ACID guarantees that -normally only come with a database.

- - -

There are some limitations to using macid - as a datastore that you should familiarize yourself with - if you are looking into using HAppS for heavy-usage transactional applications. - But long term, HAppS with macid looks promising enough that I've started - using it as a platform for building commercial web 2.0 type apps. (My first - commercial happs app will be public soon, so stay tuned on - techcrunch.   :)   ) - -

In short, HAppS is awesome, and webmonkeys everywhere should use it. Except... - -

There is this one minor detail. - +

If you use Ruby on Rails, Django, Perl Catalyst, PHP, or some other popular web framework, but +have programmed in haskell and would like to use the world's greatest language for your next web project, +just keep reading. I promise by the time you're done you will posess all the knowledge +and sample code you need.

hunk ./templates/home.st 13 +

This tutorial is its own demo, and it is open source. The tutorial explains how to build a toy job board, which you can try out for yourself by +creating a user on this demo site, and play with locally after you have installed the source code. +The text you are reading this moment is bundled up too, hence "self-demoing tutorial." +For best results, you should +install and run +it in a local environment where you have control. Then, when you are done +learning, you can use the tutorial code as a starting point for your own +HAppS applications. +

hunk ./templates/home.st 23 +

Why HAppS?

hunk ./templates/missinghappsdocumentation.st 3 -

Unfortunately, the documentation for HAppS is +

When I started building this demo/tutorial, the documentation for HAppS was hunk ./templates/missinghappsdocumentation.st 5 -So bad that honestly I wouldn't know where to start to fix it. +So bad that honestly I wasn't sure where to start with trying to fix it. hunk ./templates/missinghappsdocumentation.st 11 -that included clear step-by-step instructions for getting from zero to final product. I figure what the HAppS +that included clear step-by-step instructions for getting from zero to final product. +There is still a lot of work to be done in the documentation and usability department. +That haddock still needs to be written, and more than anything, HAppS needs to be used and discussed +by more people in forums, blogs, wikis, and real applications like hackage +(which I think is already using HAppS or will be soon). +These things tend to snowball. My hope is that this tutorial will play a part in bringing +commercial-use HAppS and haskell into the real world. + +

+I figured what the HAppS hunk ./templates/missinghappsdocumentation.st 22 -doing real work by leveraging this technology. So the demo project is a job board. +doing real work by leveraging this technology. + +

In this spirit, the demo project is a job board. hunk ./templates/missinghappsdocumentation.st 27 -$! -Somewhat to my shame, I still haven't learned how HAppS data migrations work, -so every time I release a new version of the tutorial I lose all data -- however, if any real seeming jobs -get posted, I will make sure this doesn't happen. A good explanation of HAppS data migration is my top priority -for the next version anyway. !$ - - -$! There is a real job board, based on code from this tutorial, at fpjobs.com. !$ - -

-By the way, -I am currently available for haskell, HAppS, and startup consulting. -

hunk ./templates/missinghappsdocumentation.st 36 -$! -I created this project, the Real -World HAppS Tutorial, to popularize the use of haskell, with HAppS, in web applications. -!$ -

+

+On this note, I am currently available for haskell, HAppS, and startup consulting: thomashartman1 at gmail. +Write me if there is anything you need. +

hunk ./templates/missinghappsdocumentation.st 41 -

Let's get started.

+

Now let's get started.

hunk ./templates/runtutoriallocally.st 8 -

The cabal installation may take up to an hour, mainly because the -HAppS-Server installation is slow, but it should succeed in one -shot. This is a symptom of the HAppS slow linking bug. +

The cabal installation is kind of slow. I've had it take up to 15 minutes. But it should succeed in one +shot. (This is a symptom of the HAppS slow linking bug.) + +

Unfortunately, the above statement is false on ghc 6.10.1 at the moment, because +
the crypto package won't cabal install out of the box. You can build crypto first by doing +
darcs get http://code.haskell.org/crypto +
cd crypto +
cabal install +
Hopefully the crypto package will get a version bump on hackage soon so I can delete this ugly orange paragraph.
hunk ./templates/runtutoriallocally.st 21 -

  • Haskell: You need at least ghc 6.8.2 to install HAppS. I installed this with with apt-get install haskell (works for ubuntu hardy heron), and then upgraded to ghc 6.8.3 as this is supposed to have fixed some bugs.
  • -
  • Dependency chasing haskell package installers: you should have the latest versions of cabal and cabal install from hackage. These are already included in the latest version of ghc, or they will be soon. Another reason to upgrade to ghc 6.8.3.
  • +
  • Haskell: I use ghc 6.10.1, and suggest you do too. + I installed this with with apt-get install haskell (works for ubuntu hardy heron), and then upgraded to ghc 6.10.1.
  • +
  • Dependency chasing haskell package installers: you should have the latest versions of cabal and cabal install from hackage. These are already included in the latest version of ghc, or they will be soon. I have +
    cabal --version +
    cabal-install version 0.6.0 +
    using version 1.6.0.1 of the Cabal library +
    The latest version of cabal is a bit tricky to install. What I did was start with ghc 6.10.1 and then + download the tar file of the latest version of cabal from hackage, unzip that and run bootstrap.sh. + +
  • hunk ./templates/runtutoriallocally.st 68 +

    As far as I know, this issue does not occur when you run the tutorial from a compiled executable, which is of course + how you should be running for a production application. + hunk ./templates/toc.st 1 -[("/tutorial/home","happs intro") +[("/tutorial/home","build a web 2.0 app in happs") + , ("/tutorial/why-happs-is-cool","why happs is cool")