A non-strict, pure, statically typed, polymorphic, higher-order, functional programming language which evolved from Miranda and the ML family of semi-functional languages. Haskell has an advanced type system which, in addition to the parametrizable algebraic datatypes familiar from ML, allows overloading via type classes, both on type constants and type constructors. It supports imperative constructs such as destructive update and exceptions via the notion of monads.

The major compiler implementations are the Glasgow Haskell Compiler (GHC), the Haskell B. Compiler (HBC) and NHC. Hugs is a Haskell interpreter suitable for small platforms. Hugs and GHC will soon be interoperable.

Other notable features of the Haskell language or its implementations include garbage collection, type inference, the pioneering COM/CORBA foreign function interface embodied in H/Direct and GreenCard, extensions such as multi-parameter type classes and second-order polymorphism, lazy evaluation, extensible infix syntax and layout syntax (as in Python).

Haskell is a functional programming language created circa 1992, and is today used largely by universities as a theoretical language to be used as a learning tool, and by software engineers in order to prototype a program which will then be written in other languages, such as Java and C++. This is a shame, since Haskell is actually a wonderful language to work in. Since it was not designed along the C strand of language (like Java and C++), it is less reliant on syntax, which means that there is less bracketing issues, and no semicolons at the ends of lines. This also means that it is a lot more readable to the lay person. For example:

greeter::String->String
greeter input = 
    if all valid input then 
        "Hello " ++ input

In the above example, we have defined a function called greeter, which takes in a string of characters (a.k.a a word or a sentence) and returns the same string preceded by the word "Hello" and a space. Typically, you would type your name in. In the above example, I have pattern matched the input string to the word input. I have then used a built in function, all, to run each character of the string through the function valid, which would be defined later. In this way, programs can be evolved in a functional way, so that one can work through the program in a logical way, without having to plan too far ahead, you just have to work out what you want to take in, and what you want to be returned, and then define functions to help you along the way. You can even define dummy functions:

dummy::Integer->String
dummy input = undefined

This means that you can compile the program to check that it works so far, but without having done all of the work yet. The other way of doing this is splitting the program up into reusable modules, which are compiled separately, so that you can fully compile one working part, and use it wherever you like, whilst working on another part. The language can also be quite mathematical, for example:

shapes::String->String
shapes input = 
    if all valid input then
    "Area " ++  show totalArea ++ ", centre " ++ showp totalCentre
    else "Invalid : Program needs valid input in order to run"
        where
        totalArea = areaOf shapeList
        totalCentre= centreOf shapeList
        shapeList = turnToShapes input

The use of the 'where' block allows equations to be formed, which can then be defined later, in this case, using library functions, such as all and show and functions which are defined elsewhere, such as turnToShapes, areaOf, showp, valid and centreOf.

Haskell programs tend to be quite a lot shorter than, for example, Java programs for these reasons. One disadvantage of Haskell is that the input output is quite odd, but for this reason, compilers like ghci and hugs have been written which are able to run the program interactively, i.e. handling the IO themselves so that you don't have to. Another disadvantage is that EMACS, many programmers text editor of choice, needs a patch in order to run Haskell mode properly (i.e. syntax highlighting etc.)

In all, I find Haskell a refreshing language to code in, it teaches you how to think, and makes subsequent programming in other languages much easier

Three Types for the Lisp-kings under the parentheses,
Seven for the Web-lords in their halls of XHTML,
Nine for C Developers doomed to segfault,
One for the Dark Lord on his dark throne
In the Land of Haskell where the Monads lie.
One Type to rule them all, One Type to find them,
One Type to bring them all and in the Lambda >>= them
In the Land of Haskell where the Monads lie.

Log in or register to write something here or to contact authors.