What is Haskell actually useful for? [closed]

Tag: haskell Author: lidahe Date: 2009-10-05

I really hope nobody deems this question as closable because it's a pretty straight forward one.

I Googled this question, but not much information was found that was concise and informative for me.

For instance, if I start learning Haskell, what can I find myself using it for. What are some common uses for this language that I hear is a functional one.?

No, I won't because it's a clear cut answer. No wiggle room for opinions and such. I just want to know what the language was created for.
@Papuccino1, wait, do you want to know what it's useful for, or what it was created for? The former is what the question is asking, and there's a lot of room for opinion there...
For those of you who are wringing your hands over whether or not this question should be CW, see here: meta.stackexchange.com/questions/392/…
@Papuccino1 - What benefit do the extra words in your title bring to the question? Also, I think you're misunderstanding the use of the term "functional" in this context, but it's hard to tell.

Best Answer

What are some common uses for this language?

Rapid application development.

If you want to know why Haskell? Then you need to consider advantages of functional programming language (taken from http://c2.com/cgi/wiki?AdvantagesOfFunctionalProgramming):

  • Functional programs tend to be much more terse than their ImperativeLanguage counterparts. Often this leads to enhanced programmer productivity

  • FP encourages quick prototyping. As such, I think it is the best software design paradigm for ExtremeProgrammers... but what do I know.

  • FP is modular in the dimension of functionality, where ObjectOrientedProgramming is modular in the dimension of different components.

  • The ability to have your cake and eat it. Imagine you have a complex OO system processing messages - every component might make state changes depending on the message and then forward the message to some objects it has links to. Wouldn't it be just too cool to be able to easily roll back every change if some object deep in the call hierarchy decided the message is flawed? How about having a history of different states?

  • Many housekeeping tasks made for you: deconstructing data structures (PatternMatching), storing variable bindings (LexicalScope with closures), strong typing (TypeInference), GarbageCollection, storage allocation, whether to use boxed (pointer-to-value) or unboxed (value directly) representation...

  • Safe multithreading! Immutable data structures are not subject to data race conditions, and consequently don't have to be protected by locks. If you are always allocating new objects, rather than destructively manipulating existing ones, the locking can be hidden in the allocation and GarbageCollection system.

Apart from this Haskell has its own advantages such as

  • Clear, intuitive syntax inspired by mathematical notation.
  • List comprehensions to create a list based on existing lists.
  • Lambda expressions: create functions without giving them explicit names. So it's easier to handle big formulas.
  • Haskell is completely referentially transparent. Any code that uses I/O must be marked as such. This way, it encourages you to separate code with side effects (e.g. putting text on the screen) from code without (calculations).
  • Lazy evaluation is a really nice feature:
    • Even if something would usually cause an error, it will still work as long as you don't use the result. For example, you could put 1 / 0 as the first item of a list and it will still work if you only used the second item.
    • It is easier to write search programs such as this sudoku solver because it doesn't load every combination at once—it just generates them as it goes along. You can do this in other languages, but only Haskell does this by default.

You can check out following links:


Nice answer. Quite enlightening.
lambda calculus? lambda expressions i think is what you mean..
The first half of the answer was copied verbatim from c2.com/cgi/wiki?AdvantagesOfFunctionalProgramming . Is this legal?
He sited the source...not sure why it wouldn't be legal...
sudoku solver link is broken

Other Answer1

I think people in this post are missing the most important point for anyone who has never used a functional programming language: expanding your mind. If you are new to functional programming then Haskell will make you think in ways you've never thought before. As a result your programming in other areas and other languages will improve. How much? Hard to quantify.

Other Answer2

There is one good answer for what a general purpose language like Haskell is good for: writing programs in general.

For what it is used for in practice, I've three approaches to establishing that:

Indicates that it is good for graphics, networking, systems programming, data structures, databases, development, text processing ...

And finally, my opinion on what it is really strong at:

I hope that gives you a sense on how broad your question is, if it is to be answered with any specificity.

Other Answer3

From the Haskell Wiki:

Haskell has a diverse range of use commercially, from aerospace and defense, to finance, to web startups, hardware design firms and lawnmower manufacturers. This page collects resources on the industrial use of Haskell.

According to Wikipedia, the Haskell language was created out of the need to consolidate existing functional languages into a common one which could be used for future research in functional-language design.

It is apparent based on the information available that it has outgrown it's original purpose and is used for much more than research. It is now considered a general purpose functional programming language.

If you're still asking yourself, "Why should I use it?", then read the Why use it? section of the Haskell Wiki Introduction.

Other Answer4

One example of Haskell in action is xmonad, a "featureful window manager in less than 1200 lines of code".

Other Answer5

Haskell is a general purpose programming language. It can be used for anything you use any other language to do. You aren't limited by anything but your own imagination. As for what it's suited for? Well, pretty much everything. There are few tasks in which a functional language does not excel.

And yes, I'm the Rayne from Dreamincode. :)

I would also like to mention that, in case you haven't read the Wikipedia page, functional programming is a paradigm like Object Oriented programming is a paradigm. Just in case you didn't know. Haskell is also functional in the sense that it works; it works quite well at that.

Just because a language isn't an Object Oriented language doesn't mean the language is limited by anything. Haskell is a general-purpose programming language, and is just as general purpose as Java.

Other Answer6

You can look here for some of the users that companies have found for it:

Other Answer7

You might want to read Why Haskell Matters.

Other Answer8

I have a cool one, facebook created a automated tool for rewriting PHP code. They parse the source into an abstract syntax tree, do some transformations:

if ($f == false) -> if (false == $f)

I don't know why, but that seems to be their particular style and then they pretty print it.


We use haskell for making small domain specific languages. Huge amounts of data processing. Web development. Web spiders. Testing applications. Writing system administration scripts. Backend scripts, which communicate with other parties. Monitoring scripts (we have a DSL which works nicely together with munin, makes it much easier to write correct monitor code for your applications.)

All kind of stuff actually. It is just a everyday general purpose language with some very powerful and useful features, if you are somewhat mathematically inclined.

Other Answer9

From Haskell:

Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry.

Basically Haskell can be used to create pretty much anything you would normally create using other general-purpose languages (e.g. C#, Java, C, C++, etc.).

Other Answer10

This is a pretty good source for info about Haskell and its uses:

Open Source Haskell Releases and Growth

Other Answer11

For example, for developing interactive, realtime HTML5 web applications. See Elm, the compiler of which is implemented in Haskell and the syntax of which borrows a lot from Haskell's.