Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Haskell used for in the real world? [closed]

There is a lot of hype around Haskell, however, it is hard to get information on how it is used in the real world applications. What are the most popular projects / usages of Haskell and why it excels at solving these problems?

like image 682
Sergio Tapia Avatar asked Oct 22 '09 03:10

Sergio Tapia


People also ask

Is Haskell used today?

Haskell is used in academia and industry. As of May 2021, Haskell was the 28th most popular programming language by Google searches for tutorials, and made up less than 1% of active users on the GitHub source code repository.

Why is Haskell not used in industry?

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.

Where is Haskell being used?

There are lists of companies that use Haskell on the Haskell web site and on Quora. A few highlights are Facebook, IBM, Twitter, AT&T, Bank of America, Barclays Capital, NVIDIA and Microsoft. Some interesting links are: Facebook uses Haskell in several projects, for example Fighting spam with Haskell.

Why does nobody use Haskell?

Haskell is not taught in schools and is almost never used in industry. Thus, there is very little incentive for programmers to learn the language except out of pure intellectual interest. It doesn't help that it's very different from mainstream languages and harder to learn.


2 Answers

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.

like image 42
wheaties Avatar answered Oct 05 '22 01:10

wheaties


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 languages (taken from https://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:

  • https://c2.com/cgi/wiki?AdvantagesOfFunctionalProgramming
  • https://docs.microsoft.com/archive/blogs/wesdyer/why-functional-programming-is-important-in-a-mixed-environment
  • https://web.archive.org/web/20160626145828/http://blog.kickino.org/archives/2007/05/22/T22_34_16/
  • https://useless-factor.blogspot.com/2007/05/advantage-of-functional-programming.html
like image 77
Xinus Avatar answered Oct 05 '22 01:10

Xinus