found drama

get oblique

review: Developing Web Applications with Haskell and Yesod

by Rob Friesel

Developing Web Applications with Haskell and YesodI thought that I might be the target audience for this book, but I was mistaken. In the preface of Developing Web Applications with Haskell and Yesod (O’Reilly, 2012), author Michael Snoyman describes this book as “for” two groups:

The first group is long time Haskell users–already convinced of the advantages of Haskell—who are looking for a powerful framework for creating web applications. The second is web developers who are either dissatisfied with their existing tools, or are looking to expand their horizons into the functional world.

I wasn’t in the first group, but–gathering some enthusiasm from (arguably much smarter) friends–I thought that I might be in the second group. Succumbing to this peer pressure, and my own curiosity about Haskell, I dove in. I did this despite Snoyman’s other assertion in the preface, that the book assumes a basic familiarity with Haskell. Having dabbled with Haskell before,[1] I’d assumed I’d at least be able to follow along.

Unfortunately, I struggled to follow along. Snoyman is clearly intimate with Yesod,[2] and quite knowledgeable of Haskell in a general sense, but part of me fears that this hinders the text–that in increasing the expected knowledge of the reader, that it comes at the cost of being accessible to newcomers. On the one hand, it seems unfair to say that Snoyman takes your level of expertise with Haskell for granted; after all, he does warn everyone up front that he is assuming some familiarity with the language. On the other hand, I have approached several web frameworks written in and backed by languages that I am otherwise new to, and have never been as stymied as I was here. As a counter example, when I was new to Grails, I picked up a copy of Grails in Action[3] to guide my early foray; at that time, I had never before encountered Grails, had never written any Groovy, and was about as knowledgeable of Java then as I am of Haskell now.[4] And though I found numerous flaws with Grails in Action, they did get several things right–and two things that they utterly nailed were:

  1. the first chapter where they walk you through building a trivial web app in 28 pages; and
  2. their 32 page language introduction which they aptly named “The Groovy Essentials”.

There really are no strong analogs to this in Snoyman’s book: there is no trivial starter sample web app (not at the beginning), and the introduction to Haskell runs from page 7 to page 13.

It did not help that I had trouble even getting Haskell and Yesod running on my machine.[5]

I also did not fully understand what unique value Yesod brought as a web application framework. Snoyman mentions type-safety early and often, but this seemed to me to be an implicit benefit that did not get any clear illustrations. It was almost as if you were expected to already know what this was in fine-grained detail, and as such a demonstration was a foregone conclusion.

This is not to say that there were no compelling features presented and discussed. I saw several intriguing glimmers in the text. The i18n system[6] made my eyes light up, as did the high-level design of the widget system.[7] But these are small examples that make up the larger tapestry that I simply did not have the patience or inclination to finish weaving together.

All was not lost, however. Those promising glimmers? They did increase my interest in Haskell. I picked up Learn You a Haskell for Great Good! to read alongside this one, to get more familiar with the language itself while I otherwise dove into Yesod. Haskell itself is compelling, and I’m sure that I’ll take a return trip to Yesod when I have a clearer picture of the surrounding landscape.

Disclosure: I received an electronic copy of this book from the publisher in exchange for writing this review.

  1. The final chapter of Bruce Tate’s Seven Languages in Seven Weeks deals with Haskell. I did not believe (even naïvely) that this had given me a “command” of Haskell, but I had thought it enough of an introduction to at least get started here. One might say that I was wrong. []
  2. Considering that he is the framework’s principal author, he ought to be. []
  3. My December 2010 review of Grails in Action is here. []
  4. Which is to say that I had some exposure to it, and enough knowledge of its basics to do some simple things, but not enough confidence to do anything useful. []
  5. Snoyman does not refer to specific versions of anything, so I found myself more/less forced to experiment. I installed the latest version of the Haskell Platform via Homebrew, and though I got the Cabal package manager running, the Yesod platform itself failed to compile. After going in circles with the compiler error reports, I eventually tried an older version of the Haskell Platform and that seemed to resolve things. Unfortunately, by then I was pretty demoralized and frustrated and a lot of my interest waned. []
  6. Of all the nerdy little details to get excited about… []
  7. Although I’ll admit that the syntax of Hamlet et al. still screws up my brow. []

About Rob Friesel

Software engineer by day, science fiction writer by night. Author of The PhantomJS Cookbook and a short story in Please Do Not Remove. View all posts by Rob Friesel →

2 Responses to review: Developing Web Applications with Haskell and Yesod

Ivan says:

Hi! Good review, and feels familiar – in terms of both Haskell and O’Reilly. Did you ever get back to Yesod? Or web development with Haskell?

I blow hot and cold about Haskell. At the moment (most of my web work is in erlang) I’m finding the idea of strong typing in web development quite attractive.

What do you think tem months after writing this review?

Best wishes

Ivan

found_drama says:

@Ivan–

I haven’t had a chance to come back to Haskell/Yesod since I wrote this. I have a pretty broad interest in functional programming, and as such Haskell re-enters the conversation over and over again. I imagine that I’ll come back to Yesod at some point after I’ve had a chance to get better acclimated with Haskell. (I’m thinking of working through Bruce Tate’s book again.)

As for strong typing… Coming from a place where JavaScript is my bread and butter, it has taken me some time to come around to it. I certainly see the advantages now, but tend to think in terms of dynamic typing more/less by default.

cheers,

-r

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*