Haskell (programming language) Information & Haskell (programming language) Links at HealthHaven.com
advertise
add site
services
publishers
database
health videos
Bookmark and Share

search wiki for    ?
web dir firms image gallery news pdf wiki shop video 
about
toolbar
stats
live show
health store
more stuff
JOIN/LOGIN
Featured Results:
Preschool Language Program - Speech-Language Pathology Program -...
Preschool Language Program - Speech-Language Pathology Program -...
childrenshospital.org
 
Haskell
Logo of Haskell
Usual file extensions .hs, .lhs
Paradigm functional, non-strict, modular
Appeared in 1990
Designed by Simon Peyton Jones, Paul Hudak[1], Philip Wadler, et al.
Typing discipline static, strong, inferred
Major implementations GHC, Hugs, NHC, JHC, Yhc
Dialects Helium, Gofer
Influenced by Lisp and Scheme, ISWIM, FP, APL, Hope and Hope+, SISAL, Miranda, ML and Standard ML, Lazy ML, Orwell, Alfl, Id, Ponder
Influenced Agda, Bluespec, Clojure, C#, CAL, Cat, Cayenne, Clean, Curry, Epigram, Escher, F#, Factor, Isabelle, Java Generics, LINQ, Mercury, Omega, Perl 6, Python, Qi, Scala, Timber, Visual Basic 9.0
OS portable
Website haskell.org

Haskell (pronounced [ˈhæskəl][2][3]) is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry.

Contents

[edit] History

Following the release of Miranda by Research Software Ltd, in 1985, interest in lazy functional languages grew.[citation needed] By 1987, more than a dozen non-strict, purely functional programming languages existed. Of these, Miranda was the most widely used, but was not in the public domain. At the conference on Functional Programming Languages and Computer Architecture (FPCA '87) in Portland, Oregon, a meeting was held during which participants formed a strong consensus that a committee should be formed to define an open standard for such languages. The committee's purpose was to consolidate the existing functional languages into a common one that would serve as a basis for future research in functional-language design.[4] The first version of Haskell ("Haskell 1.0") was defined in 1990.[5] The committee's efforts resulted in a series of language definitions. In late 1997, the series culminated in Haskell 98, intended to specify a stable, minimal, portable version of the language and an accompanying standard library for teaching, and as a base for future extensions. The committee expressly welcomed the creation of extensions and variants of Haskell 98 via adding and incorporating experimental features.[4]

In February 1999, the Haskell 98 language standard was originally published as "The Haskell 98 Report".[4] In January 2003, a revised version was published as "Haskell 98 Language and Libraries: The Revised Report".[6] The language continues to evolve rapidly, with the GHC implementation representing the current de facto standard.

In early 2006, the process of defining a successor to the Haskell 98 standard, informally named Haskell′ ("Haskell Prime"), was begun.[7] This is an ongoing incremental process to revise the language definition, producing a new revision once per year. The first revision, named Haskell 2010, was announced in November 2009.[8]

[edit] Overview and distinguishing features

Haskell is a purely functional language, which means that in general, functions in Haskell do not have side effects. There is a distinct type for representing side effects, orthogonal to the type of functions. A pure function may return a side effect which is subsequently executed, modeling the impure functions of other languages.

Haskell has a non-strict semantics. Most implementations of Haskell use lazy evaluation.

Haskell has a strong, static, type system based on Hindley-Milner type inference. Haskell's principal innovation in this area is to add type classes, which were originally conceived as a principled way to add overloading to the language,[9] but have since found many more uses[10].

The type which represents side effects is an example of a monad. Monads are a general framework which can model different kinds of computation, including error handling, nondeterminism, parsing, and software transactional memory. Monads are defined as ordinary datatypes, but Haskell provides some syntactic sugar for their use.

The language has an open, published, specification,[6] and multiple implementations exist.

There is an active community around the language, and more than 1700 third-party open-source libraries and tools are available in the online package repository Hackage.[11]

The main implementation of Haskell, GHC, is both an interpreter and native-code compiler that runs on most platforms. GHC is noted for its high-performance implementation of concurrency and parallelism,[12] and for having a rich type system incorporating recent innovations such as generalized algebraic data types and Type Families.

[edit] Features

[edit] Syntax

[edit] Layout

Haskell allows indentation to be used to indicate the beginning of a new declaration. For example, in a where clause:

 product xs = prod xs 1   where     prod []     a = a     prod (x:xs) a = prod xs (a*x) 

The two equations for the nested function prod are aligned vertically, which allows the semi-colon separator to be omitted. In Haskell, indentation can be used in several syntactic constructs, including do, let, case, class, and instance.

The use of indentation to indicate program structure originates in Landin's ISWIM language, where it was called the off-side rule. This was later adopted by Miranda, and Haskell adopted a similar (but rather more complicated) version of Miranda's off-side rule, which it called "layout". Other languages to adopt whitespace-sensitive syntax include Python and F#.

The use of layout in Haskell is optional. For example, the function product above can also be written:

 product xs = prod xs 1   where { prod [] a = a; prod (x:xs) a = prod xs (a*x) } 

The explicit open brace after the where keyword indicates that the programmer has opted to use explicit semi-colons to separate declarations, and that the declaration-list will be terminated by an explicit closing brace. One reason for wanting support for explicit delimiters is that it makes automatic generation of Haskell source code easier.

Haskell's layout rule has been criticised for its complexity. In particular, the definition states that if the parser encounters a parse error during processing of a layout section, then it should try inserting a close brace (the "parse error" rule). Implementing this rule in a traditional parsing/lexical-analysis combination requires two-way cooperation between the parser and lexical analyser, whereas in most languages these two phases can be considered independently.

[edit] The rest of the syntax

  • Functions, currying, application, abstraction
  • Operators
  • Namespaces
  • Declarations vs Expressions
  • List comprehensions

[edit] Algebraic data types

Algebraic data types are used extensively in Haskell. Some examples of these are the built in list, Maybe and Either types:

 -- A list of a's ([a]) is either an a consed (:) onto another list of a's, or an empty list ([]) data [a] = a : [a] | [] -- Something of type Maybe a is either Just something, or Nothing data Maybe a = Just a | Nothing -- Something of type Either atype btype is either a Left atype, or a Right btype data Either a b = Left a | Right b 

Users of the language can also define their own abstract data types. An example of an ADT used to represent a person's name, sex and age might look like:

 data Sex = Male | Female data Person = Person String Sex Int -- Notice that Person is both a constructor and a type   -- An example of creating something of type Person tom :: Person tom = Person "Tom" Male 27 

[edit] Pattern matching

Pattern matching is used to match on the different constructors of algebraic data types. Here are some functions, each using pattern matching on each of the types above:

 -- This type signature says that empty takes a list containing any type, and returns a Bool empty :: [a] -> Bool empty (x:xs) = False empty [] = True   -- Will return a value from a Maybe a, given a default value in case a Nothing is encountered fromMaybe :: a -> Maybe a -> a fromMaybe x (Just y) = y fromMaybe x Nothing  = x   isRight :: Either a b -> Bool isRight (Right _) = True isRight (Left _)  = False   getName :: Person -> String getName (Person name _ _) = name   getSex :: Person -> Sex getSex (Person _ sex _) = sex   getAge :: Person -> Int getAge (Person _ _ age) = age 

Using the above functions, along with the map function, we can apply them to each element of a list, to see their results:

 map empty [[1,2,3],[],[2],[1..]] -- returns [False,True,False,False]   map (fromMaybe 0) [Just 2,Nothing,Just 109238, Nothing] -- returns [2,0,109238,0]   map isRight [Left "hello", Right 6, Right 23, Left "world"] -- returns [False, True, True, False]   map getName [Person "Sarah" Female 20, Person "Alex" Male 20, tom] -- returns ["Sarah", "Alex", "Tom"], using the definition for tom above 
  • Abstract Types
  • Lists

[edit] Tuples

Tuples in haskell can be used to hold a fixed number of elements. They are used to group pieces of data of differing types:

 account :: (String, Integer, Double) -- The type of a three-tuple, representing a name, balance, interest rate account = ("John Smith",102894,5.25) 

Tuples are commonly used in the zip* functions to place adjacent elements in separate lists together in tuples (zip4 to zip7 are provided in the Data.List module):

 -- The definition of the zip function. Other zip* functions are defined similarly zip :: [a] -> [b] -> [(a,b)] zip (a:as) (b:bs) = (a,b) : zip as bs zip _      _      = []   zip [1..5] "hello" -- returns [(1,'h'),(2,'e'),(3,'l'),(4,'l'),(5,'o')] -- and has type [(Integer, Char)]   zip3 [1..5] "hello" [False, True, False, False, True] -- returns [(1,'h',False),(2,'e',True),(3,'l',False),(4,'l',False),(5,'o',True)] -- and has type [(Integer,Char,Bool)] 

In the GHC compiler, tuples are defined with sizes from 2 elements up to 62 elements.

  • Records

[edit] Type system

  • Type classes
  • Type defaulting
  • Overloaded Literals
  • Higher Kinded Polymorphism
  • Multi-Parameter Type Classes
  • Functional Dependencies


[edit] Monads and input/output

  • Overview
  • Applications
    • Monadic IO
    • Do-notation
    • References
    • Exceptions

[edit] ST monad

The ST monad allows programmers to write imperative algorithms in Haskell, using mutable variables (STRef's) and mutable arrays (STArrays and STUArrays). The advantage of the ST monad is that it allows programmers to write code that has internal side effects, such as destructively updating mutable variables and arrays, while containing these effects inside the monad. The result of this is that functions written using the ST monad appear completely pure to the rest of the program. This allows programmers to produce imperative code where it may be impractical to write functional code, while still keeping all the safety that pure code provides.

Here is an example program (taken from the Haskell wiki page on the ST monad) that takes a list of numbers, and sums them, using a mutable variable:

 import Control.Monad.ST import Data.STRef import Control.Monad   sumST :: Num a => [a] -> a sumST xs = runST $ do            -- runST takes stateful ST code and makes it pure.     summed <- newSTRef 0         -- Create an STRef (a mutable variable)       forM_ xs $ \x -> do          -- For each element of the argument list xs ..         modifySTRef summed (+x)  -- add it to what we have in n.       readSTRef summed             -- read the value of n, which will be returned by the runST above. 

[edit] STM monad

The STM monad is an implementation of Software Transactional Memory in Haskell. It is implemented in the GHC compiler, and allows for mutable variables to be modified in transactions.


[edit] Arrows

  • Applicative Functors
  • Arrows

As Haskell is a pure functional language, functions cannot have side effects. Being non-strict, it also does not have a well-defined evaluation order. This is a challenge for real programs, which among other things need to interact with an environment. Haskell solves this with monadic types that leverage the type system to ensure the proper sequencing of imperative constructs. The typical example is I/O, but monads are useful for many other purposes, including mutable state, concurrency and transactional memory, exception handling, and error propagation.

Haskell provides a special syntax for monadic expressions, so that side-effecting programs can be written in a style similar to current imperative programming languages; no knowledge of the mathematics behind monadic I/O is required for this. The following program reads a name from the command line and outputs a greeting message:

 main = do putStrLn "What's your name?"           name <- getLine           putStr ("Hello, " ++ name ++ "!\n") 

The do-notation eases working with monads. This do-expression is equivalent to, but (arguably) easier to write and understand than, the de-sugared version employing the monadic operators directly:

 main = putStrLn "What's your name?" >> getLine >>= \ name -> putStr ("Hello, " ++ name ++ "!\n") 
See also wikibooks:Transwiki:List of hello world programs#Haskell for another example that prints text.

[edit] Concurrency and parallelism

The Haskell language definition itself does not include either concurrency or parallelism, although GHC supports both.

[edit] Concurrency

Concurrent Haskell is an extension to Haskell that provides support for threads and synchronization.[13] GHC's implementation of Concurrent Haskell is based on multiplexing lightweight Haskell threads onto a few heavyweight OS threads,[14] so that Concurrent Haskell programs run in parallel on a multiprocesor. The runtime can support millions of simultaneous threads.[15]

The GHC implementation employs a dynamic pool of OS threads, allowing a Haskell thread to make a blocking system call without blocking other running Haskell threads.[16] Hence the lightweight Haskell threads have the characteristics of heavyweight OS threads, and the programmer is unaware of the implementation details.

Recently, Concurrent Haskell has been extended with support for Software Transactional Memory (STM), which is a concurrency abstraction in which compound operations on shared data are performed atomically, as transactions.[17] GHC's STM implementation is the only STM implementation to date to provide a static compile-time guarantee preventing non-transactional operations from being performed within a transaction. The Haskell STM library also provides two operations not found in other STMs: retry and orElse, which together allow blocking operations to be defined in a modular and composable fashion.

[edit] Parallelism

[edit] Programming in the large

  • FFI
  • Modules
  • Packages

[edit] Semantics

[edit] Extensions to Haskell

A number of extensions to Haskell have been proposed. These extensions provide features not described in the language specification, or they redefine existing constructs. As such, each extension may not be supported by all Haskell implementations. There is an ongoing effort[18] to describe extensions and select those which will be included in future versions of the language specification.

The extensions[19] supported by the Glasgow Haskell Compiler include:

  • Unboxed types and operations. These represent the primitive datatypes of the underlying hardware, without the indirection of a pointer to the heap or the possibility of deferred evaluation. Numerically intensive code can be significantly faster when coded using these types.
  • The ability to specify strict evaluation for a value, pattern binding, or datatype field.
  • More convenient syntax for working with modules, patterns, list comprehensions, operators, records, and tuples.
  • Syntactic sugar for computing with arrows and recursively-defined monadic values. Both of these concepts extend the monadic do-notation provided in standard Haskell.
  • A significantly more powerful system of types and typeclasses, described below.
  • Template Haskell, a system for compile-time metaprogramming. A programmer can write expressions that produce Haskell code in the form of an abstract syntax tree. These expressions are typechecked and evaluated at compile time; the generated code is then included as if it were written directly by the programmer. Together with the ability to reflect on definitions, this provides a powerful tool for further extensions to the language.
  • Quasi-quotation, which allows the user to define new concrete syntax for expressions and patterns. Quasi-quotation is useful when a metaprogram written in Haskell manipulates code written in a language other than Haskell.
  • Generic typeclasses, which specify functions solely in terms the algebraic structure of the types they operate on.
  • Parallel evaluation of expressions using multiple CPU cores. This does not require explicitly spawning threads. The distribution of work happens implicitly, based on annotations provided by the programmer.
  • Compiler pragmas for directing optimizations such as inline expansion and specializing functions for particular types.
  • Customizable rewrite rules. The programmer can provide rules describing how to replace one expression with an equivalent but more efficiently evaluated expression. These are used within core datastructure libraries to provide improved performance[20] throughout application-level code.

[edit] Type system extensions

An expressive static type system is one of the major defining features of Haskell. Accordingly, much of the work in extending the language has been directed towards types and type classes.

The Glasgow Haskell Compiler supports an extended type system based on the theoretical System Fc[21]. Major extensions to the type system include:

  • Arbitrary-rank and impredicative polymorphism. Essentially, a polymorphic function or datatype constructor may require that one of its arguments is itself polymorphic. Impredicative polymorphism is now considered deprecated, and can be eliminated by declaring a new monomorphic datatype to wrap a polymorphic type.
  • Generalized algebraic data types. Each constructor of a polymorphic datatype can encode information into the resulting type. A function which pattern-matches on this type can use the per-constructor type information to perform more specific operations on data.
  • Existential types. These can be used to "bundle" some data together with operations on that data, in such a way that the operations can be used without exposing the specific type of the underlying data. Such a value is very similar to an object as found in object-oriented programming languages.
  • Data types that do not actually contain any values. These can be useful to represent data in type-level metaprogramming.
  • Type families: user-defined functions from types to types. Whereas parametric polymorphism provides the same structure for every type instantiation, type families provide ad-hoc polymorphism with implementations that can differ between instantiations. Use cases include content-aware optimizing containers and type-level metaprogramming.
  • Implicit function parameters that have dynamic scope. These are represented in types in much the same way as type class constraints.

Extensions relating to type classes include:

  • A type class may be parametrized on more than one type. Thus a type class can describe not only a set of types, but an n-ary relation on types.
  • Functional dependencies, which constrain parts of that relation to be a mathematical function on types. That is, the constraint specifies that some type class parameter is completely determined once some other set of parameters is fixed. This guides the process of type inference in situations where otherwise there would be ambiguity.
  • Significantly relaxed rules regarding the allowable shape of type class instances. When these are enabled in full, the type class system becomes a Turing-complete language for logic programming at compile time.
  • Type families, as described above, may also be associated with a type class.
  • The automatic generation of certain type class instances is extended in several ways. New type classes for generic programming and common recursion patterns are supported. Additionally, when a new type is declared as isomorphic to an existing type, any type class instance declared for the underlying type may be lifted to the new type "for free".

[edit] Examples

[edit] Factorial

A simple example that is often used to demonstrate the syntax of functional languages is the factorial function for non-negative integers, shown in Haskell:

 factorial :: Integer -> Integer factorial 0 = 1 factorial n = n * factorial (n-1) 

Or in one line:

 factorial n = if n > 0 then n * factorial (n-1) else 1 

This describes the factorial as a recursive function, with one terminating base case. It is similar to the descriptions of factorials found in mathematics textbooks. Much of Haskell code is similar to standard mathematical notation in facility and syntax.

The first line of the factorial function describes the type of this function; while it is optional, it is considered to be good style[22] to include it. It can be read as the function factorial (factorial) has type (::) from integer to integer (Integer -> Integer). That is, it takes an integer as an argument, and returns another integer. The type of a definition is inferred automatically if the programmer didn't supply a type annotation.

The second line relies on pattern matching, an important feature of Haskell. Note that parameters of a function are not in parentheses but separated by spaces. When the function's argument is 0 (zero) it will return the integer 1 (one). For all other cases the third line is tried. This is the recursion, and executes the function again until the base case is reached.

A guard protects the third line from negative numbers for which a factorial is undefined. Without the guard this function would, if called with a negative number, recurse through all negative numbers without ever reaching the base case of 0. As it is, the pattern matching is not complete: if a negative integer is passed to the factorial function as an argument, the program will fail with a runtime error. A final case could check for this error condition and print an appropriate error message instead.

Using the product function from the Prelude, a number of small functions analogous to C's standard library, and using the Haskell syntax for arithmetic sequences, the factorial function can be expressed in Haskell as follows:

 factorial n = product [1..n] 

Here [1..n] denotes the arithmetic sequence 1, 2, …, n in list form. Using the Prelude function enumFromTo, the expression [1..n] can be written as enumFromTo 1 n, allowing the factorial function to be expressed as

 factorial n = product (enumFromTo 1 n) 

which, using the function composition operator (expressed as a dot in Haskell) to compose the product function with the curried enumeration function can be rewritten in point-free style:[23]

 factorial = product . enumFromTo 1 

In the Hugs interpreter, one often needs to define the function and use it on the same line separated by a where or let..in. For example, to test the above examples and see the output 120:

 let { factorial n | n > 0 = n * factorial (n-1); factorial _ = 1 } in factorial 5 

or

 factorial 5 where factorial = product . enumFromTo 1 

The GHCi interpreter doesn't have this restriction and function definitions can be entered on one line and referenced later.

[edit] More complex examples

A simple Reverse Polish notation calculator expressed with the higher-order function foldl whose argument f is defined in a where clause using pattern matching and the type class Read:

 calc :: String -> [Float] calc = foldl f [] . words   where      f (x:y:zs) "+" = (y + x):zs     f (x:y:zs) "-" = (y - x):zs     f (x:y:zs) "*" = (y * x):zs     f (x:y:zs) "/" = (y / x):zs     f xs y = read y : xs 

The empty list is the initial state, and f interprets one word at a time, either matching two numbers from the head of the list and pushing the result back in, or parsing the word as a floating-point number and prepending it to the list.

The following definition produces the list of Fibonacci numbers in linear time:

 fibs = 0 : 1 : zipWith (+) fibs (tail fibs) 

The infinite list is produced by corecursion — the latter values of the list are computed on demand starting from the initial two items 0 and 1. This kind of a definition relies on lazy evaluation, an important feature of Haskell programming. For an example of how the evaluation evolves, the following illustrates the values of fibs and tail fibs after the computation of six items and shows how zipWith (+) has produced four items and proceeds to produce the next item:

 fibs         = 0 : 1 : 1 : 2 : 3 : 5 : ...                +   +   +   +   +   + tail fibs    = 1 : 1 : 2 : 3 : 5 : ...                =   =   =   =   =   = zipWith ...  = 1 : 2 : 3 : 5 : 8 : ... fibs = 0 : 1 : 1 : 2 : 3 : 5 : 8 : ... 

The same function, written using GHC's parallel list comprehension syntax (GHC extensions must be enabled using a special command-line flag '-fglasgow-exts'; see GHC's manual for more):

 fibs = 0 : 1 : [ a+b | a <- fibs | b <- tail fibs ] 

The factorial we saw previously can be written as a sequence of functions:

 factorial n = (foldl (.) id [\x -> x*k | k <- [1..n]]) 1 

A remarkably concise function that returns the list of Hamming numbers in order:

 hamming = 1 : map (2*) hamming `merge` map (3*) hamming `merge` map (5*) hamming      where merge (x:xs) (y:ys)              | x < y = x : xs `merge` (y:ys)             | x > y = y : (x:xs) `merge` ys             | otherwise = x : xs `merge` ys 

Like the various fibs solutions displayed above, this uses corecursion to produce a list of numbers on demand, starting from the base case of 1 and building new items based on the preceding part of the list.

In this case the producer merge is defined in a where clause and used as an operator by enclosing it in back-quotes. The branches of the guards define how merge merges two ascending lists into one ascending list without duplicate items.

[edit] Implementations

The following all comply fully, or very nearly, with the Haskell 98 standard, and are distributed under open source licenses. There are currently no proprietary Haskell implementations.

  • The Glasgow Haskell Compiler (GHC) compiles to native code on a number of different architectures—as well as to ANSI C—using C-- as an intermediate language. GHC is probably the most popular Haskell compiler, and there are quite a few useful libraries (e.g. bindings to OpenGL) that will work only with GHC.
  • Gofer was an educational dialect of Haskell, with a feature called "constructor classes", developed by Mark Jones. It was supplanted by Hugs (see below).
  • HBC is another native-code Haskell compiler. It has not been actively developed for some time but is still usable.
  • Helium is a newer dialect of Haskell. The focus is on making it easy to learn by providing clearer error messages. It currently lacks full support for type classes, rendering it incompatible with many Haskell programs.
  • The Utrecht Haskell Compiler (UHC) is a Haskell implementation from Utrecht University. UHC supports almost all Haskell 98 features plus many experimental extensions. It is implemented using attribute grammars and is currently mainly used for research into generated type systems and language extensions.
  • Hugs, the Haskell User's Gofer System, is a bytecode interpreter. It offers fast compilation of programs and reasonable execution speed. It also comes with a simple graphics library. Hugs is good for people learning the basics of Haskell, but is by no means a "toy" implementation. It is the most portable and lightweight of the Haskell implementations.
  • Jhc is a Haskell compiler written by John Meacham emphasising speed and efficiency of generated programs as well as exploration of new program transformations. LHC, is a recent fork of Jhc.
  • nhc98 is another bytecode compiler, but the bytecode runs significantly faster than with Hugs. Nhc98 focuses on minimizing memory usage, and is a particularly good choice for older, slower machines.
  • Yhc, the York Haskell Compiler is a fork of nhc98, with the goals of being simpler, more portable and more efficient, and integrating support for Hat, the Haskell tracer. It also features a JavaScript backend allowing users to run Haskell programs in a web browser.

[edit] Tools

  • Profiling
  • Debugging
  • Testing
  • Alex and Happy
  • Haddock
  • Hoogle and Hayoo
  • WinHugs [2] — Haskell interpreter for Windows

[edit] Distribution

[edit] Hackage

Since January 2007, libraries and applications written in Haskell have been collected on Hackage, an online database of open source Haskell software using Cabal packaging tool. As of December 2009 there are about 1700 packages available.[11]

Hackage provides a central point for the distribution of Haskell software, via Cabal, and has become a hub for new Haskell development activity. Installing new Haskell software via Hackage is possible via the cabal-install tool:

 $ cabal install xmonad 

which recursively installs required dependencies if they are available on Hackage. This makes installation of Haskell code easier than had been possible previously.

[edit] Cabal

  • cabal-install

[edit] The Haskell Platform

To cope with the growing number of libraries, the Haskell Platform was launched in September 2008 to provide a standard, quality-assured suite of Haskell libraries, available on every machine. The library standardisation project is modelled on GNOME's release process.

The first release of the Haskell Platform was in May 2009.

[edit] Libraries

[edit] Applications

Haskell is increasingly being used in commercial situations[24]. Audrey Tang's Pugs is an implementation for the long-forthcoming Perl 6 language with an interpreter and compilers that proved useful after just a few months of its writing; similarly, GHC is often a testbed for advanced functional programming features and optimizations. Darcs is a revision control system written in Haskell, with several innovative features. Linspire GNU/Linux chose Haskell for system tools development.[25] Xmonad is a window manager for the X Window System, written entirely in Haskell.

Bluespec SystemVerilog is a language for semiconductor design that is an extension of Haskell. Additionally, Bluespec, Inc.'s tools are implemented in Haskell. Cryptol, a language and toolchain for developing and verifying cryptographic algorithms, is implemented in Haskell. Notably, the first formally verified microkernel, seL4 was developed in Haskell.

[edit] Open source applications

There are many open source Haskell applications, most distributed from Hackage. A few of note:

[edit] Development

Complete listing in Hackage:Development

  • haddock – A documentation-generation tool for Haskell libraries
  • alex - a lexer generator
  • happy - a parser generator
  • cabal-install - a tool for online distribution of cabal packages

[edit] Databases

Complete listing in Hackage:Databases

  • haskelldb - a strongly typed SQL database layer for Haskell.
  • HDBC - comprehensive database support
  • Takusen - database library with left-fold interface

[edit] Games

Complete listing in Hackage:Games.

  • bloxorz - a 3D logic game
  • Frag - a 3D first person shooter game
  • hback - an 'nback' memory puzzle
  • monadius - a 2D scroller game

[edit] Graphics

Complete listing in Hackage:Graphics.

  • gtk2hs - a gui library based on GTK+
  • wxHaskell - portable GUI library based on wxWidgets
  • qtHaskell - Haskell interface to the QT library
  • SDL - interface to libSDL.

[edit] Languages and compilers

Complete listing in Hackage:Language

  • Pugs – a compiler and interpreter for the Perl 6 programming language
  • Lava - the Lava hardware description language
  • Curry - the functional/logic language Curry.
  • cpphs – an implementation of the C preprocessor
  • Agda – the Agda programming language
  • Flapjax -- a language for reactive programming in the browser
  • uuagc – an implementation of Attribute Grammars
  • Language.Python - tools for manipulating Python source
  • [3] - Language.C - tools for manipulating the C language
  • WebBits - tools for manipulating JavaScript

[edit] System tools

Complete listing at Hackage:System

  • Darcs – an advanced revision control system
  • Xmonad – a popular tiling window manager
  • House – an operating system written using Haskell

[edit] Text processing

Complete listing in Hackage:Text

  • pandoc – a tool to convert between different text markup languages
  • Yi – an emacs-like text editor
  • Leksah [4] – an IDE developed in Haskell, mainly for Haskell. Integrates source-browsing/intelli-sense, debugging and package building.
  • HaXml - a comprehensive xml toolset
  • The Grammatical Framework - a library for manipulation of natural languages.

[edit] Networking

Complete listing in Hackage:Network

  • gitit – a wiki based on distributed revision control
  • happstack -– a web application framework (the Haskell "Rails")

[edit] Office tools

  • hledger -- an accounting tool for commodities

[edit] Commercial applications

Further accounts of the use of Haskell in industry are collected via the Commercial Users of Functional Programming workshop series, and collected on Haskell.org's industry page.

[edit] Research projects

[edit] Community

[edit] Related languages

Concurrent Clean is a close relative of Haskell, whose biggest deviation from Haskell is in the use of uniqueness types instead of monads for I/O and side-effects.

A series of languages inspired by Haskell, but with different type systems, have been developed, including:

  • Epigram, a functional programming language with dependent types suitable for proving properties of programs
  • Agda, a functional programming language with dependent types

Other related languages include:

  • Curry, a language based on Haskell
  • Jaskell, a functional scripting programming language that runs in Java VM

[edit] Haskell variants

Haskell has served as a testbed for many new ideas in language design. There have been a wide number of Haskell variants produced, exploring new language ideas, including:

[edit] Criticism

Jan-Willem Maessen, in 2002, and Simon Peyton Jones, in 2003, discussed problems associated with lazy evaluation while also acknowledging the theoretical motivation for it[26][27], in addition to purely practical considerations such as improved performance.[28] They note that, in addition to adding some performance overhead, laziness makes it more difficult for programmers to reason about the performance of their code (particularly its space usage).

Bastiaan Heeren, Daan Leijen, and Arjan van IJzendoorn in 2003 also observed some stumbling blocks for Haskell learners: "The subtle syntax and sophisticated type system of Haskell are a double edged sword — highly appreciated by experienced programmers but also a source of frustration among beginners, since the generality of Haskell often leads to cryptic error messages."[29] To address these, they developed an advanced interpreter called Helium which improved the user-friendliness of error messages by limiting the generality of some Haskell features, and in particular removing support for type classes.

[edit] Haskell conferences and workshops

The Haskell community meets regularly for research and development activities. The primary events are:

Since 2007 there has been a series of organized "hackathons" - the Hac series - aimed at improving the programming language tools and libraries:

  • Oxford, UK, 2007
  • Freiburg, Germany, 2007
  • Gothenburg, Sweden, 2008
  • Utrecht, The Netherlands, 2009
  • Philadelphia, USA, 2009
  • Edinburgh, UK, 2009
  • Portland, USA, 2009

Since 2005, a growing number of Haskell User Groups have formed, in the USA, Canada, Australia, South America, Europe and Asia.

[edit] References

  1. ^ Professor Paul Hudak's Home Page
  2. ^ http://www.haskell.org/pipermail/haskell-cafe/2008-January/038756.html
  3. ^ http://www.haskell.org/pipermail/haskell-cafe/2008-January/038758.html
  4. ^ a b c "Haskell 98 Language and Libraries: The Revised Report". December 2002. http://haskell.org/onlinereport/index.html. 
  5. ^ "The History of Haskell". http://www.haskell.org/haskell-history.html. 
  6. ^ a b Simon Peyton Jones (editor) (December 2002). "Haskell 98 Language and Libraries: The Revised Report". http://haskell.org/onlinereport/. 
  7. ^ "Welcome to Haskell'". The Haskell' Wiki. http://hackage.haskell.org/trac/haskell-prime. 
  8. ^ Simon Marlow, Tue Nov 24 05:50:49 EST 2009: "[Haskell] Announcing Haskell 2010"
  9. ^ How to make ad-hoc polymorphism less ad hoc P. Wadler, S. Blott, Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, 1989, ACM
  10. ^ Fun with Functional Dependencies, or Types as Values in Static Computations in Haskell T. Hallgren, Proceedings of the Joint CS/CE Winter Meeting, Varberg, Sweden, January 2001,
  11. ^ a b http://hackage.haskell.org/cgi-bin/hackage-scripts/stats
  12. ^ Computer Language Benchmarks Game
  13. ^ Simon Peyton Jones, Andrew Gordon, and Sigbjorn Finne. Concurrent Haskell. ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (PoPL). 1996. (Some sections are out of date with respect to the current implementation.)
  14. ^ Runtime Support for Multicore Haskell (Simon Marlow, Simon Peyton Jones, Satnam Singh) ICFP '09: Proceeding of the 14th ACM SIGPLAN international conference on Functional programming, Edinburgh, Scotland, August 2009
  15. ^ http://donsbot.wordpress.com/2009/09/05/defun-2009-multicore-programming-in-haskell-now/
  16. ^ Extending the Haskell Foreign Function Interface with Concurrency (Simon Marlow, Simon Peyton Jones, Wolfgang Thaller) Proceedings of the ACM SIGPLAN workshop on Haskell, pages 57--68, Snowbird, Utah, USA, September 2004
  17. ^ Tim Harris, Simon Marlow, Simon Peyton Jones, Maurice Herlihy "Composable memory transactions" Proceedings of the tenth ACM SIGPLAN symposium on Principles and practice of parallel programming, 2005
  18. ^ http://hackage.haskell.org/trac/haskell-prime/
  19. ^ http://www.haskell.org/ghc/docs/latest/html/users_guide/ghc-language-features.html
  20. ^ http://www.cse.unsw.edu.au/~dons/papers/CLS07.html
  21. ^ http://www.cse.unsw.edu.au/~chak/papers/SCPD07.html
  22. ^ HaskellWiki: Type signatures as good style
  23. ^ HaskellWiki: Pointfree
  24. ^ See Industrial Haskell Group for collaborative development, Commercial Users of Functional Programming for specific projects and Haskell in industry for a list of companies using Haskell commercially
  25. ^ "Linspire/Freespire Core OS Team and Haskell". Debian Haskell mailing list. May 2006. http://urchin.earth.li/pipermail/debian-haskell/2006-May/000169.html. 
  26. ^ Jan-Willem Maessen. Eager Haskell: Resource-bounded execution yields efficient iteration. Proceedings of the 2002 ACM SIGPLAN workshop on Haskell.
  27. ^ Simon Peyton Jones. Wearing the hair shirt: a retrospective on Haskell. Invited talk at POPL 2003.
  28. ^ Lazy evaluation can lead to excellent performance, such as in The Computer Language Benchmarks Game[1]
  29. ^ Bastiaan Heeren, Daan Leijen, Arjan van IJzendoorn. Helium, for learning Haskell. Proceedings of the 2003 ACM SIGPLAN workshop on Haskell.

[edit] External links

[edit] Tutorials




Product Results (view all...)

search wiki for    ?
web dir firms image gallery news pdf wiki shop video 



↑ top of page ↑about thumbshots