Monday, April 5, 2010

Happy Easter and some more Haskell

Happy Easter everyone ! :)

Last time I've written about good ways to learn Haskell, now I'd like to present why should you tackle this language.
  1. Its purely functional. If you have no idea what that means you can visit wiki or this page. Some most notable characteristics are : 
    • recursion is used instead of loops,
    • everything you can do with some data can also be done with functions (you can say that functions are 'first class') - this is pretty awesome,
    • 'side-effects' are very visible (something I'd like when working with OpenGL),
    • based on Lambda Calculus (explanations of the last two you could find here),
    • (...).
  2. The first argument may not be convincing very much - there are lots of stuff you won't ever understand, why get into lambda ? For a standard Programmer, the bread and butter are languages of imperative or object orientation. It turns out that some of these languages, like C#, Python, possibly Java, are coming with functional-like ways of programming. It may be tricky to understand at first and some say its the best to learn it in a pure form.
  3. Haskell can be and is used in real projects.
  4. It is very efficient. Maybe not as fast as C, but the development is faster. Usually the speed up C would give you is not that big compared to efficiency you would gain by implementing a better algorithm. I've seen (rather small in number of code lines) some tests showing that Haskell beats languages like Python and Ruby by a lot.
  5. Some people, for example Simon Peyton, call it the most beautiful language.
  6. A new look at the concurrent computing with Software Transactional Memory (STM). Simon Peyton Jones in his chapter of Beautiful Code shows the faulty of achieving multi-threading by using locks and gives a solution to the 'Santa' problem using Haskell. I'll surely write about this, when I find out more. Some (small) tests I've seen prove its efficiency and elegance. This is the aspect of Haskell that I'm personally most excited about.
I suppose there are a lot more reasons to learn Haskell. I've name only these 6 due to lack of my knowledge. Please post your own reasons for learning this language.

I've promised some Haskell-exercises and I shall post some in the near future.

No comments:

Post a Comment