Lojic Technologies

Haskell In The Finals

with 3 comments

As I explain in 2009 Programming Language Plan, I’ve been in the process of evaluating programming languages to determine their suitability for use in my work. I’ve been proceeding on two fronts – statically typed functional programming languages and the venerated Lisp family.

Haskell The Hope Of The Statically Typed Family

After many hours of research and a brief dive into Standard ML, I’ve selected Haskell as the best candidate for me to evaluate statically typed functional programming languages. At this point, I’m subjectively biased against statically typed functional programming languages because of the enjoyment and productivity I’ve found in Ruby & Lisp, but my only experience with statically typed languages (C, C++, Java) has not been representative of good statically typed languages, so I’m reluctant to form a strong opinion of static typing before I’ve become proficient in a good statically typed language.

There are, of course, a number of respected statically typed functional programming languages, but I think Haskell provides me with the best opportunity to make a personal assessment regarding the benefits of static typing for my particular situation, and I think someone would be hard pressed to convince me that it’s a poor choice objectively.

There Can Be Only One

After working halfway through Programming in Standard ML by Robert Harper, I realized that I enjoy the language and it seems simpler & cleaner than Haskell, but I also realized that I only have time to become truly proficient in one statically typed functional programming language in the near future. I feel that a reasonable level of proficiency is required to evaluate a language well. I have seen many examples of someone, with only a little knowledge of a programming language, making an unfounded criticism of a programming language, or a particular feature, only to be corrected with an accurate, elegant and convincing counter argument by someone who is experienced with the language.

A quick survey of a language won’t be enough for me to make a decision on some key points such as static vs. dynamic, nonstrict vs. strict, pure vs. impure, etc. as well as important peripheral issues such as existing libraries, tools, etc. – it’s going to require understanding some of the subtleties of the language and writing enough code to get a feel for the language, so I felt I needed to limit my choice to one statically typed FPL.

Static vs. Dynamic

Clearly both static and dynamic typing work well for large numbers of people. One of my goals is simply to answer the static vs. dynamic question for myself given my preferences and the type of software I want to develop. I’d previously decided to learn both Standard ML and Haskell, so my reasons below for choosing Haskell are primarily with respect to comparing the two languages:

Haskell Is Pure And Lazy

I’m already familiar with impure, or multi-paradigm, programming languages that offer some functional features but allow imperative programming, so being forced to program in a purely functional manner and abandon my comfort zone of imperative patterns is an advantage for me. I have no experience with lazy languages, so Haskell offers an opportunity to gain more experience with laziness :).

In some respects, Haskell is more different than Lisp compared to other statically typed functional programming languages, so it’s a good point of comparison. It may end up being the ultimate death match 🙂

  • Static vs. Dynamic
  • Nonstrict vs. Strict
  • Rich/Complex Syntax vs. Simpler Syntax
  • Pure vs. Impure/Multi-paradigm

Active Community

Haskell has a very active community. Although I’m skeptical about whether a statically typed functional programming language will be suitable for the type of work I want to do with it, it makes sense to choose one that has a reasonable shot, and I don’t personally feel that Standard ML does – it was mainly to be an introduction to functional programming and a stepping stone to another FPL.

Part of the reason I don’t feel that Standard ML has a reasonable shot is that it feels dated and somewhat abandoned. Functional programming languages are niche languages to begin with, but it seems that Haskell and OCaml both have fairly strong communities.

Cool Features

Although I think Haskell’s custom of continuing to add cutting edge research features into the language may have some disadvantages if not done well, i.e. making the language messier and complicated, for my primary purpose of evaluating the benefits of statically typed languages, I think having more advanced features is an advantage over Standard ML. If a language with such an active research community as Haskell fails to convince me of the benefits of static typing, then it may just not be for me.

Monads and type classes seem interesting, and Haskell provides an opportunity to learn them. Monads seem useful outside of Haskell, so the time spent learning about them can be leveraged. I already like list comprehensions, so it’s nice to have them available again.

Learning some of the advanced features of Haskell will be beneficial to me regardless of whether I continue programming in Haskell or decide to go with the Lisp family.

Textual Resources

Standard ML actually has a surprising number of good texts available, so I don’t think Haskell offers a big advantage here, but in my particular case, I already own two Haskell texts – Programming in Haskell by Graham Hutton and The Craft of Functional Programming by Simon Thompson. Also, Chris Okasaki’s Purely Functional Data Structures provides Haskell examples as does Richard Bird’s Introduction to Functional Programming using Haskell (2nd ed.). Lastly, I think Real World Haskell may be very helpful.

Haskell Crash Course

My goal now on the statically typed front is to become as proficient in Haskell as I can in a very short period of time. There seem to be plenty of resources available, but if you’re aware of any particularly helpful resources or tips, feel free to add a comment.

Written by Brian Adkins

August 18, 2009 at 11:36 am

Posted in programming

Tagged with

3 Responses

Subscribe to comments with RSS.

  1. Quote:
    I feel that a reasonable level of proficiency is required to evaluate a language well. I have seen many examples of someone, with only a little knowledge of a programming language, making an unfounded criticism of a programming language, or a particular feature, only to be corrected with an accurate, elegant and convincing counter argument by someone who is experienced with the language.

    I can’t agree on this. Usually after a short time I have good understanding is language worth it or not. After a while I could get used to something but it just never finds place in my heart. I’ve tried Haskell for few weeks I’m pretty sure that it’s not my kind of language. Links about my experiences are below. Beside why not giving a chance to Mark Tarver Qi http://www.lambdassociates.org/ ?

    (*) http://tourdelisp.blogspot.com/2008/03/lisper-first-look-at-haskell.html
    (**) http://tourdelisp.blogspot.com/2008/03/farewell-haskell.html

    Slobodan Blazeski

    August 26, 2009 at 7:57 am

  2. Slobodan, I did look at Qi briefly and found it to be interesting. Mark Tarver seems to have abandoned it though which is a mild concern. I may add it to my list of Lisps to study.

    In some ways, I wish I could simply make a quick decision about Haskell – it would save me time and effort, but it might also cause me to miss out on some valuable ideas. You stated that you didn’t learn anything new from Haskell. That could be because you already know the ideas it presents, or it could be because you didn’t spend enough time with it.

    Although they may not be new with Haskell, or uniquely associated with it, I think Haskell is a good language to learn about functional purity, laziness, monads, static type inference, etc. Even if I go with Lisp in the end, I think it will be time well spent for me personally.

    Brian Adkins

    August 26, 2009 at 9:04 am

  3. Since there is no huge company or community to fall on niche languages like lisp, haskell, prolog, apl & forth usually work best under very specific circumstances.
    Though things might have changed since the last time I’ve checked haskell ecosystem was worse then common lisp by very far. Though I don’t mind being outside mainstream I would really want to hear about companies making money with it before I bet my applications on it.

    BTW what kind of work the language you’re looking should be suitable for? From reading your 2009 language plan I assume you’re thinking of web applications and judging by the latest trend you should probably learn some good javascript library (like qooxdoo or dojo) and pool some data from the server back end from whatever language you’re most familiar with (be it Lisp Hunchentoot, Elang Yaws or whatever is the name of the Haskell web server). If you still prefer to avoid javascript solutions maybe weblocks http://weblocks.viridian-project.de/ might be interesting for you. It’s very well documented and tested in production use with active community and helpful maintainers.
    If you’re more into something cutting edge but don’t mid if its still into development Thomas Elam Dojo Zen http://www.box.net/shared/mxv4hqrp2p might be interesting for you.

    Slobodan Blazeski

    August 26, 2009 at 9:59 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: