Real World HAppS

Haskell is a great way to program.

And HAppS is a great way to build web applications.

Especially 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.

The above description is a bit idealized. Keeping everything in macid limits you to how much RAM you can afford, and even if you can afford a lot (16GB in the amazon cloud costs \$576/month) there's no guarantee that you won't max that out if your application has a lot of data. (See the stress test chapter for more caveats.) The HAppS developers have promised a version of HAppS that will make it easy to share ram across computers with a technique called sharding, but this hasn't been released in a way that inspires confidence in me (on hackage, sufficient documentation), and to be honest I don't really understand how it is supposed to work even in theory. But what is realistic is to write an alpha version of an application without a database access layer, and then add persistent hard drive storage (probably database, but could also be flat files or name your poison) outside of macid when it becomes necessary. Most web projects do not get to a size where this is necessary, so arguably coding in a database from a start is a form of insidious premature optimization, if you buy the argument that using a database from the start introduces significant maintenance overhead.

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.

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

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

There is this one minor detail.