Haskell programming language.

 
FREE EXCERPT

Haskell is a standardized pure functional programming language with non-strict semantics. Named after the logician Haskell Curry, it was created by a committee formed in 1987 for the express purpose of defining such a language. The latest semi-official language standard is Haskell 98, intended to specify a minimal, portable version of the language for teaching and as a base for future extensions. The language continues to evolve rapidly, with Hugs and GHC (see below) representing the current de facto standard.

Characterizing syntax features in Haskell include pattern matching, currying, list comprehensions, guard statements, and definable operators. The language also supports recursive functions and datatypes, as well as lazy evaluation. Unique concepts include monads, and type classes. The combination of such features can make functions which would be difficult to write in a procedural programming language almost trivial to implement in Haskell.

The language is, as of 2002, the lazy functional language on which the most research is being performed. Several variants have been developed: parallelizable versions from M1T and Glasgow, both called Parallel Haskell; more parallel and distributed versions called Distributed Haskell (formerly Goffin) and Eden; a speculatively evaluating version called Eager Haskell and several object oriented versions: Haskell++, O'Haskell and Mondrian.

Although Haskell has a comparatively small user community, its strengths have been well applied to a few projects. Autrijus Tang's Pugs is an interpreter and compiler for the Perl 6 language, completed in a few months. DARCS is a revision control system, with several innovative features. There is also a Haskell-like language that offers a new method of support for GUI development called Concurrent Clean. Its biggest deviation from Haskell is in the use of uniqueness types for input as opposed to monads.

Examples

The "Hello World" of functional Ian ages is the factorial function. Expressed as pure Haskell:

fac 0 = 1 fac n = n * fac (n-1) This is similar to how a math textbook defines factorials, as is much Haskell dealing with math, Notably, parameters of a function are not in parentheses but simply separated by spaces. The "Prelude" is a number of small functions analogous to C's standard library. Using the prelude and writing in the "point free" style of unspecified arguments, it becomes:

fac = product * enumFromTo 1 The above is close to the mathematacal...

To continue reading

REQUEST YOUR TRIAL