Revision 1 as of 2003-08-21 17:28:53

Clear message

Haskell

Haskell is a very modern functional language. It is used for some "real" projects (not just an experiment language) but is uncommon in industry. More information can be found at http://www.haskell.org/. (Please forgive or correct any errors here due to my not being very familiar with Haskell.)


Haskell and Python are a somewhat odd pair to compare, because they are so different in many ways. But what most users of both languages would agree they DO share is a certain elegance of design.

Functional vs Procedural:

Haskell is a true functional language, while Python offers tools for a profusion of styles, including procedural and object-oriented. Python has some support for a functional style of programming, but the profusion of side effects and the lack of tail recursion (elimination thereof), make it an awkward style to use in Python. A procedural style is nearly impossible to use in Haskell.

Compiled vs Interpreted:

Python is interpreted, while Haskell is compiled. The biggest difference that this makes is in execution speed. Haskell is surprisingly fast (surprising to those who think non-comercial languages are necessarily slowpokes), while nearly all Python programmers suggest that it's probably "fast enough", and that if it isn't, then the critical sections should be re-written in C/C++.

Static vs Dynamic Typing:

Both Haskell and Python have strong (not weak) typing... instances of a type can only be used as that type. But Haskell has static typing, while Python has dynamic typing. This means that in Haskell, the type of every expression and every variable is known at compile time (and strictly enforced), while in Python expressions and variables don't even HAVE a type (the objects they refer to have types, but that isn't known until runtime). Since typing is such a fundamental part of Haskell (it's part of what makes the language easy to reason about), this difference is a fundamental one. However, for those python users who shudder to think of typing "int i" before every variable use, take heart: Haskell is often used as the example of "static typing done right", because it has type inference... in most cases the compiler can figure out the type for you, so declarations are ooptional, except where they carry actual information.

There is also one similarity I feel compelled to point out:

List Comprehension Syntax:

Python's list comprehension syntax is taken (with trivial keyword/symbol modifications) directly from Haskell. The idea was just too good to pass up.

Contributors: MichaelChermside

See also LanguageComparisons.

Unable to edit the page? See the FrontPage for instructions.