A little about Haskell, including why it is so weird:
Haskell tries to be object oriented and functional at the same time. In a sense, it succeeds. Haskell functions are inherently generic, so that you can, for instance, sum a list of anything that you can add two of.
Haskell lets you define vocabularies, but it calls those vocabularies "Classes", if I recall correctly. The idea is that a subclass responds to all the same operations as its superclass, and then some. Using an operation constrains its operand to the classes for which that operation has meaning.
To put it another way, the nouns of Haskell are the data type definitions and their corresponding constructors. The verbs are the functions that apply to those nouns, and the semantics are the interplay of function, domain, and range.
I personally believe that Haskell suffers greatly from (at least) two major flaws.
First of all, the terms Haskell uses to describe different parts of its language are kind of strange in comparison to other languages. What Haskell calls a class most closely resembles an interface in Java, an abstract base in C++, or an abstract data type in computer-science-speak. There is a mainstream idea of what a class is, embodied in C++, Java, Smalltalk, and even some variants of Pascal: a member of a forest (or, in C++, DAG) of record types annotated with polymorphic methods. Haskell's classes are dramatically different from that norm.
Second, Haskell's monads are just too hard to explain. In theory, the monad is a wonderful idea. Unfortunately, monads are like a golden hammer for the woes of pure lazy functional programming. Monads are how anything gets done in Haskell, because they structure interactions with the world into sequential computations. Without them, it would be impossible to write a Haskell program that did anything observable. However, they represent a significant conceptual hurdle for the newcomer, and one that other languages don't have. Much more ink has been spent ranting and raving about how great monads are than explaining how and when to use them.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home