Is Haskell suitable as a first language?

Solution 1:

Well, the existence of SICP suggests that functional languages can be used as introductory material. Scheme is perhaps more approachable than Haskell, however.

Haskell seems to have a reputation for being "difficult" to learn, but people tend to forget that classic imperative programming is difficult to learn as well. Many people struggle at first with the concept of assigning a value to a variable, and a surprising number of programmers never actually do become comfortable with pointers and indirect references.

The connections between Haskell and abstract mathematics don't really matter as much as people sometimes assume, but for someone interested in the math anyway, looking at the analogies might provide an interesting bonus.

Solution 2:

There has been at least one study on the effects of teaching Haskell to beginner programmers:

  • The Risks and Benefits of Teaching Purely Functional Programming in First Year. Manuel M. T. Chakravarty and Gabriele Keller. Journal of Functional Programming 14(1), pp 113-123, 2004.

With the following abstract:

We argue that teaching purely functional programming as such in freshman courses is detrimental to both the curriculum as well as to promoting the paradigm. Instead, we need to focus on the more general aims of teaching elementary techniques of programming and essential concepts of computing. We support this viewpoint with experience gained during several semesters of teaching large first-year classes (up to 600 students) in Haskell. These classes consisted of computer science students as well as students from other disciplines. We have systematically gathered student feedback by conducting surveys after each semester. This article contributes an approach to the use of modern functional languages in first year courses and, based on this, advocates the use of functional languages in this setting.

So, yes, you can use Haskell, but you should focus on elementary, general techniques and essential concepts, rather than functional programming per se.

There are a number of popular books for beginner programmers that also make it an attractive target for teaching these elementary concepts, including:

  • "Programming in Haskell"
  • "The Craft of Functional Programming"

Additionally, Haskell is already widely taught as a first language. -- but remember, the key is to focus on the core concepts as illustrated in Haskell, not to teach the large, rich language that is Haskell itself.

Solution 3:

I'll go against the popular opinion and say that Haskell is NOT a good first programming language for the typical first-time programmer. I don't think it is as approachable for a raw beginner as imperative languages like Ruby.

The reason for this, is that people do not think about the world in a functional manner. When they see a car driving down the street, they see the same car, with ever-changing mutable state. They don't see a series of slightly different immutable cars.

If you check out other SO questions, you'll see that Haskell is pretty much never mentioned as a good choice for a beginner.

However, if you are a mathematician, or already know enough about programming to understand the value of functional programming, I think Haskell is a fine choice.

So to summarize, I think Haskell is a perfect fit for you, but not a good fit for the typical beginner.

EDIT: Thanks for the insightful comments. Owen's point that people think in a multi-paradigm manner is very true. This strengthens my belief that a multi-paradigm language like Ruby would be easier to pick up, and has the added benefit of exposing the student to both imperative and functional thinking. Haskell is decidedly not multi-paradigm.

Chuck mentioned Haskell's sophisticated type system which is another great point. While I personally prefer statically typed languages, using a dynamic language allows a beginner to ignore that piece of the puzzle until they are curious enough to find out what is going on behind the scenes. Haskell's type system, while elegant, is in your face from day 1.

Solution 4:

Eleven reasons to use Haskell as a mathematician
I cannot write it better than that. But to summarize:

  • Haskell is declarative and mathematics is the ultimate declarative language, which means that code written in Haskell is remarkably similar to what you would write as a mathematical statement.
  • Haskell is high-level, no need to know details about caches, memory management and all the other hardware stuff. Also that means short programs which is always good.
  • Haskell is great for symbolic computation, algebra, logic ...
  • Haskell is pretty :)

To answer your question: you'll have no problem to start with a functional language as a mathematician with no programming experience. Actually it's the better choice, you won't have to repair the brain damage you would get from C/Java/whatever.
You should also check Mathematica. Some people tend to dislike it since it is a commercial closed-source product, but I think it's a pretty good environment for doing mathematics.