有很多关于Haskell的宣传,然而,很难获得关于它如何在现实应用程序中使用的信息。Haskell最流行的项目/用法是什么?为什么它能出色地解决这些问题?


当前回答

这是一个非常好的关于Haskell及其用途的信息来源:

开源Haskell发布和增长

其他回答

它的一些常见用途是什么 语言吗?

快速应用程序开发。

如果你想知道“为什么是Haskell?”,那么你需要考虑函数式编程语言的优势(摘自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.

除此之外,Haskell还有自己的优势,比如:

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.

你可以查看以下连结:

https://c2.com/cgi/wiki?AdvantagesOfFunctionalProgramming https://learn.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

来自Haskell Wiki:

Haskell有多种用途 商业上,从航空航天和 国防,金融,网络创业, 硬件设计公司和割草机 制造商。本页收集 资源在工业上的利用 Haskell。

根据维基百科的说法,Haskell语言的创建是为了将现有的函数式语言整合为一种通用的语言,以供将来在函数式语言设计方面的研究使用。

根据现有的信息,很明显,它已经超出了它最初的目的,被用于远远超过研究。它现在被认为是一种通用函数式编程语言。

如果你还在问自己:“我为什么要用它?”,那就读读《为什么要用它?》Haskell Wiki简介的一部分。

这是一个非常好的关于Haskell及其用途的信息来源:

开源Haskell发布和增长

从Haskell:

Haskell是一个标准化的、通用的纯函数 编程语言,包括 语义不严格,静态强 打字。它以逻辑学家的名字命名 Haskell咖喱。

基本上,Haskell可以用来创建几乎任何你通常使用其他通用语言(例如c#, Java, C, c++等)创建的东西。

Haskell的一个例子是xmonad,一个“用不到1200行代码的功能强大的窗口管理器”。