Haskell and exercises

by

in

The Haskell logo, from haskell.orgIn fall 2011 I took a course that covered, among other things, proving program correctness with some software called Coq.  There's a lot to it, and I won't go into that here, but one important part of Galina, the language used in Coq, that I had been unexposed to previously was functional programming.  Functional programming is a style of programming (a paradigm, in the parlance of our times) that a lot of computer science students learn as undergraduates.  I didn't, though, so this course – which used but did not teach functional programming – was quite challenging.

I ended up slugging my way through the class, and learning lots.  I  wasn't satisfied with my understanding of functional programming, though, so I decided to learn Haskell on my own.  Haskell is a pretty modern functional programming language that I'd heard lots about as an undergrad from a friend named Alan Mock (it doesn't look like he updates his blog, which is a bummer, since he's super smart and has lots of interesting opinions).  Not wanting to learn from some old, crusty, book full of greek symbols (since I get enough of that at school), I found the least-crusty programming language book ever: Learn You a Haskell for Great Good!, by Miran Lipovača.An octopus, as drawn by Miran Lipovača.

It seems to me like a somewhat narrowly targeted book – it assumes some knowledge of imperative programming, pop culture (from the time I was a child – teenage mutant ninja turtles, etc.), and a sense of humor.  That's not to say that any of these things are required, but I think you'll miss quite a bit of the joy in the book without them.  Since I'm mostly in the target audience, though, I really like the book.  I'm only a few chapters in, but it does an excellent job of explaining (what seem to me to be) pretty tough concepts.  My one complaint about the book, though, is that it doesn't have any exercises.  Without a way to test yourself at the end of a chapter or section, it's hard to tell if you've actually learned anything – I find myself playing around with the given examples / trying to figure out why they work or don't work.  That definitely helps, but it's not as direct as just working through exercises.

As an example of just how valuable exercises are even for short technical descriptions, here's a program called Logitext: it's an "educational proof assistant for first-order classical logic using the sequent calculus."  The author has an excellent tutorial, with examples throughout and some interesting problems at the end.  After just reading through the tutorial you may have some trouble with the exercises (I know I did) but after completing them, the knowledge seemed to "gel" a lot better.

The Haskell logo is from haskell.org, and the octopus playing guitar hero is from Learn You a Haskell for Great Good! by Miran Lipovača.


Comments

One response to “Haskell and exercises”

  1. […] I mentioned in a previous post, I’m trying to learn Haskell.  I’m not progressing super quickly because it’s […]

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.