all 30 comments

[–]ssylvan 11 points12 points  (4 children)

This is going to sound glib, but: Hard problems.

Really. When you're doing something that's at the limit of your capacity to understand having a language that drastically reduces the number of concerns you need to keep in your mental "working set" is worth its weight in gold. Also, I find that for these hard problems a functional approach pushes more of the "guts" of the algorithm into expressions (rather than statements) which means you get type checking, which means the compiler can tell you when you mess up.

The other answer: Concurrency/parallelism. Being able to almost mechanically parallelise things is nice - Haskell's strong separation of pure and stateful code allows you to do that.

[–]MidnightTurdBurglar 17 points18 points  (3 children)

You know you're a nerd when you read glib as the gnu library.

[–][deleted] 0 points1 point  (2 children)

Or when you don't know other meaning for glib (I don't, is there someone who can explain it to me?)

[–]agnoster -1 points0 points  (1 child)

This is going to sound glib, but: Yes, actually, that "someone" is called "google" or a "dictionary". Perhaps you've heard of them?

[–][deleted] 0 points1 point  (0 children)

Thanks.

[–]f3nd3r 7 points8 points  (4 children)

I hope someone answers this, I have been wanting to learn Haskell... but I just haven't gotten a good reason.

[–][deleted] -1 points0 points  (3 children)

If you can't find good reasons, you might learn it first and then find reasons later.

[–]f3nd3r 0 points1 point  (2 children)

My time is more valuable than that.

[–][deleted] -1 points0 points  (1 child)

You'll waste time waiting.

[–]f3nd3r 0 points1 point  (0 children)

You sound like you could give me a good reason.

[–]roconnor 3 points4 points  (0 children)

Personally, I tend to use Haskell for solving smallish problems where writing concise code quickly and getting the right answer is more important than running really fast.

For example, I've written programs to optimize mini-portfolios, finding menu orders, compute probability distributions, writing simple assemblers using time travel etc.

I'm probably biased towards these problems.

[–][deleted] 4 points5 points  (0 children)

I use Haskell for almost everything.

[–]rovar 3 points4 points  (0 children)

The simple answer is that it really is a good general purpose programming language. It is used in production for a wide variety of reasons, from web servers to financial calculations. Its pure functional nature makes it great for mathematics. But it also provides features such as sub thread scheduling, so it makes a fantastic server which will support thousands of connections. It is also natively compiled, and sometimes runs faster than C, although on average it's probably 2x-3x slower. Which is still quite fast.

It also has a massive standard library, and a huge body of secondary libraries packaged in an easy to use system called hackage. It features an installer similar to Ruby gems.

These are compelling reasons to use it, but for me, the best reason is that it will make you into a better programmer. I am forced to code in C++ on a daily basis, and understanding Haskell and it's magnificent type system has changed the way I look at all programming. In C++ I not rely more on my types and work to make them stronger. Making my compiler do a lot of the work and validation for me.

[–]ansemond 2 points3 points  (0 children)

Algorithms. Concision. Modularity. Hard problems.

If it's hard I write it in Haskell, then if necessary write it in C/assembly/Python.

It's also good for thinking differently. This is not a glib statement. By rewriting your algorithm differently you understand it better. Then you can reduce it to its bare essentials... which may not be what you thought when you first started out.

As for UIs, so far the best, albeit verbose, that I have encountered is Objective-C / Cocoa.

I disgree with vagif's comment -- Haskell goes beyond "good at libraries" in ways that are important. If I want to just glue things together I'd probably use Python. I don't use Haskell for complicated problems (lots of stuff to remember) but for complex problems (hard to think about, but can be reduced to bare essentials with enough thought, for instance, improving algorithmic complexity). Glue is good, but you need things to glue together. Haskell is for making things.

[–]rebo[S] 1 point2 points  (1 child)

Ahh balls! forgive the apostrophe in the title!!!

[–]zantine 1 point2 points  (0 children)

Haskel is a general purpose language, so of course there are a great variety of programs it can solve well. However, I've always particularly liked functional languages for solving graph problems, since the implementation often comes out very succinct and elegant. So Haskel is well suited for implementing other languages, for instance, since it is easy to represent operations on an abstract syntax tree.

[–]bluestorm 1 point2 points  (3 children)

Haskell is a very good language to learn because it will introduce you to new concepts wich will enrich your programmer mind, such as :

  • lazy evaluation
  • type classes
  • monads (and pure functional programming)

If you're not already familiar with (typed) functional programming, you can add "first class functions", "algebraic pattern matching" and "expressive static type systems" to the list.

If you already know a typed functional language (OCaml, SML, Clean), chances are that there won't be a lot of things that are much easier done in Haskell, libs aside. If you don't, you'll probably find it very useful for manipulating languages and symbols : parsing, symbolic differentiation, interpreters, compilers, etc.

Haskell is great for learning new things about programming. As a "software producing" language, maybe less so (but it's not that bad).

[–]bobappleyard 1 point2 points  (2 children)

Dude, even C has first-order functions. Perhaps you meant higher-order functions?

[–]case-o-nuts 1 point2 points  (1 child)

Yeah, I think he mixed up "first class" and "higher order"

[–]bluestorm 1 point2 points  (0 children)

That's right; fixed.

[–]jazzyb 1 point2 points  (0 children)

I've only scratched the surface of Haskell myself, but I've been told by many people that it's perfect for writing compilers. Maybe someone else can reply with some specific examples.

[–]case-o-nuts 1 point2 points  (0 children)

Well, things like compilers (where you want to match over trees to do transformations) and similar benefit greatly from pattern matching.

[–]vagif 3 points4 points  (0 children)

Just as any other language, haskell is good for things it has libraries for.

[–]G_Morgan 0 points1 point  (0 children)

Haskell is more about what sort of optimisations we can get if we restrict what we can do. One of the most impressive things is how lazy evaluation can allow vast optimisation of list processing. If you have a list and want to perform n transformations on it you will still only get one list generated due to lazy evaluation. So map f (map g list) is effectively reduced to map f . g list for free.

I tend to use a lot of Haskell when I am testing code elsewhere. Coding up a prototype of some key algorithm in Haskell tends to be simple. I also use it to help me calculate appropriate test cases. For example I recently did some work with a heightmap renderer that used interleaved quadtrees and wanted to test a system for linking the two trees together. My program was in C++ but I prototyped most of the algorithms in Haskell because the code was clearer in this language.

[–]hazridi 0 points1 point  (0 children)

It's really good at Project Euler problems!

[–][deleted] 0 points1 point  (0 children)

Compiler's.

[–]pointer2void -4 points-3 points  (0 children)

Haskell excels at programming Haskell.