Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Haskell suitable as a first language?

I have had previous exposure to imperative languages (C, some Java) however I would say I had no experience in programming. Therefore: treating me as a non-programmer, would Haskell be suitable as a first language?

My interests in Pure Mathematics and CS seem to align to the intention of most Haskell tutorials, and although i can inherently recognise the current and future industry value of imperative programming, I find the potential of functional programming (in as much as it seems such a paradigm shift) fascinating.

I guess my question can be distilled as follows - would a non-programmer have to understand imperative programming to appreciate and fully utilise functional programming?

Some references:

  • Are there any studies on whether functional/declarative or imperative programming is easier to learn as a first language?

  • Which programming languages have helped you to understand programming better?

like image 432
Alex Avatar asked Jul 29 '10 13:07

Alex


People also ask

Why is Haskell your first choice?

Haskell enables rapid development, worry-free refactoring, easy maintainability, provides excellent performance, and has a mature ecosystem. These facets among many others make it an excellent choice for building production applications.

Is Haskell Worth learning 2022?

Is Haskell Worth Learning in 2022? Yes, Haskell is worth learning in 2022 because functional languages like it are getting more popular among big companies like Facebook. Functional languages are typically ideal for big data and machine learning.

Is Haskell beginner friendly?

In general, Haskell is a good language to learn first. It's already used by a few universities in their intro sequences. I've found it does a really good job of teaching good style. Your code is naturally modular, simple and self-contained, breeding habits you can take with you to other languages.

Why is Haskell not popular?

The reason is quite obvious. The facilities and elegance of Haskell are very different from the needs of most mainstream programming. Haskell just isn't the right tool for these jobs. One of the most common patterns in popular programming is runtime polymorphism.


2 Answers

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.

like image 98
C. A. McCann Avatar answered Sep 22 '22 21:09

C. A. McCann


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.

like image 35
Don Stewart Avatar answered Sep 20 '22 21:09

Don Stewart