什么是Haskell实际上有用的? [英] What is Haskell actually useful for?
问题描述
这种
语言的常见用途是什么?
快速应用程序开发。
如果您想知道为什么Haskell?,那么您需要考虑函数式编程语言的优点(摘自 http://c2.com/cgi/wiki?AdvantageOfFunctionalProgramming ):
>
函数式程序往往比其ImperativeLanguage对应语言更为简洁。通常这会提高
程序员的工作效率。
FP鼓励快速原型设计。因此,我认为这是ExtremeProgrammers的最佳软件设计范例......但我知道什么?
FP在功能维度上是模块化的,其中ObjectOrientedProgramming在不同
组件的维度中是模块化的。
具有蛋糕和吃它的能力。想象一下,你有一个复杂的面向对象系统处理消息 - 每个组件可能会使状态
根据消息而变化,然后将消息转发给它链接到的一些
对象。如果
层次中的某个对象决定信息有缺陷,那么能不能通过
轻松地回滚每一项更改会不会太酷?如何获得
不同状态的历史?
- p>
为您制作的许多内务任务:解构数据结构(PatternMatching),存储变量绑定(LexicalScope
closures),强类型(TypeInference),GarbageCollection,存储
分配,是否使用boxed(指向值)或unboxed(value
直接)表示形式...
安全的多线程!不可变的数据结构不受数据竞争条件的影响,因此不必受
锁保护。如果您始终分配新对象,而不是
破坏性地操作现有对象,那么锁定可以隐藏在
分配和GarbageCollection系统中。
除此之外,Haskell还有其自身的优势,如:
1/0
作为列表的第一个项目,如果您只使用第二个项目,它仍然可以工作。
您可以查看以下链接: 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? 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 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: You can check out following links: 这篇关于什么是Haskell实际上有用的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
ul>
1 / 0
as the first item of a list and it will still work if you only used the second item.