This post is inspired by a similar one written by nirik.
I think this is one of the more productive holiday breaks I’ve has in the past few years. I’ve used the time to completely go to town on some of my personal projects.
The first day or two of break I just took it easy. I’ve recently become addicted to watching tournament videos by Jerry/ChessNetwork, so a lot of the time was spent eating pizza and watching those.
One of my side projects, http://eval.so/ was in major need of a rewrite. Originally written in Scala using the Play framework, I decided a while back that I wanted to redo it in Haskell. It is comprised of two parts:
sandboxcommand. Currently it is only used by the frontend code, but it could, in theory, be used by any kind of frontend (think Thrift/RPC, etc.) with not too much pain.
So my first big project was to dive into this Haskell rewrite head-first. I started a Cabal project for the backend a few weeks ago, but hadn’t really had the time to sit down and work on it, and this was my chance. The backend rewrite, aptly named “Cruncher” because it crunches numbers/code into a result, is now on GitHub. I am still porting over the language definitions from the old system, although this is a pretty easy (though boring :P) process.
The Frontend was a little more interesting. I had to pick a Haskell web framework. There are a decent number to choose from, each with their own pros and cons. I played with Yesod for a bit, and I particularly like how it handles static assets. It allows you to do page-specific assets (CSS/JS) very easily (it will cram everything a page needs into one file for the browser to request), and handles caching/etag for you out of the box. It is able to provide a large amount of compile-time safety in the template system, which is really neat. For example, instead of:
…you would write:
This prevents you from ever referencing a file that was moved/deleted. In the above example, if I move
img/such_meme_wow/doge.png without updating the
img tag accordingly, this will result in a compile-time error. This doesn’t just work for static assets, but for all handlers.
However, this safety comes at a bit of a cost. Yesod has a bit of a name for using a lot of Template Haskell, which arguably makes it seem very magical. I like fully understanding the tools that I use, or at least being able to if I choose. I am not implying that it’s impossible to come to know Yesod, but based on IRC logs and blog posts around the internet, it can at least be a lot more challenging than some of the other Haskell frameworks.
It was around this time that Ed Kmett happened to be talking in #scalaz on freenode about his experience with Haskell web frameworks. Based on the amount of Haskell code he has written, and his (very) respectable level of involvement in the Haskell community, I really valued his opinion, and kept reading the conversation. (This is posted with his permission):
< edwardk> yesod has more magic, but [it] also has better "incorrectness caught at [compile-time]" properties < edwardk> snap sites build way faster < edwardk> and eventually you understand all the magic < edwardk> whereas with yesod the magic never goes away fully < edwardk> otoh, i like knowing more things are correct, so i'm torn < edwardk> i like snap's design, and i like yesod's efforts to show your site is correctly linked < edwardk> yesod has a bunch of stuff for setting up resources for your site as data types, so the links to those resources [typecheck]
I did end up choosing Snap based on this dialog. So far, I have been really happy with it, but I haven’t done anything extremely complex with it yet. The idea of composable components (Snaplets) is really appealing. It allows for a “do one thing and do it well” mentality. Then, once everything is working, you can compose them into a single web app easily.
So basically: Lots of Haskell, lots of pizza, and chess here and there.
I will be going to visit some family from my dad’s side in the first week of January. I will be flying out to NYC on 1/4 and returning 1/8. I very much look forward to visiting the city. I haven’t been out there since elementary school on a field trip.