Overview

Haskell is a lazy, purely functional, statically typed programming language named after the logician Haskell Curry. Despite the recent popularity surge of functional languages Haskell is not a recent development having its first release in 1990.

It was influenced by a language called Miranda which saw its first release in 1985 and spawned a wide array of other lazy functional languages. Haskell grew out of a desire to move away from the proprietary language Miranda and consolidate the advances made in language design into a single language.

Following Haskell 1.0, there were number of additional specifications until the Haskell98 specification was released and is considered the first “stable” release. Published in 2010 Haskell2010, is the most recent Haskell specification.

Being a language designed by specification there are many different implementations of Haskell, however by far the most popular and feature complete is The Glasgow Haskell Compiler (GHC) which is widely considered the implementation of Haskell.

While Haskell has mostly been used as an academic language especially in the early days it is used in industry by companies such as Facebook and there are libraries for almost use case from web servers to games.

For more information you can go here

Applications

Here is a short list of applications that have been written using Haskell:

  • Pandoc: A document conversion tool
  • Darcs: A version control system, like Git but with a different approach to tracking changes
  • Xmonad: A tiling window manager for Linux

Some Code

Hello World:

main :: IO ()
main = putStrLn "Hello World"

A program that will print the first 100 Fibonacci numbers:

fibs :: [Int]
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

main :: IO ()
main = print $ take 100 fibs

Useful Libraries and Tools

Compilers and Interpreters

Haskell is a compiled language, it first gets compiled to an intermediate language which is then used to generate code for whatever the target platform is.

  • GHC: As mentioned above considered the implementation of Haskell also comes with an interpreter ghci which lets you try out various Haskell expressions in a REPL like environment.
  • GHCJS: Built using GHC allows you to compile Haskell code to Javascript.
  • Frege: Compiles most Haskell code to the JVM (Java) and allows for easy use of native Java libraries and integration with Java code.
  • Hugs: Used to be one of the main “competitors” to GHC, implementing the Haskell98 standard. However it is no longer under development.

Build Tools

Build tools are there to automate the process of compiling and managing your programs letting you focus on more important things like writing code.

  • Cabal: Is the build tool which ships with GHC and can also be used to install Haskell programs from source. However it can lead to trouble when used accross multiple projects with a problem commonly referred to as “Cabal Hell”
  • Stack: This is a relatively recent development in the Haskell community and builds on top of Cabal in an attempt to solve “Cabal Hell” by working with Stackage which maintains lists of packages and their versions which “play nice” with each other.

Libraries

Libraries are collections of code which are designed to make a particular task easier to perform, reducing the number of things you have to build and maintain yourself.

  • Hakyll: A library which helps you create a static site generator (like Jekyll) in very few lines of code.
  • Yesod: A web framework for Haskell - like Python’s Django
  • Diagrams: Used to create vector graphics
  • LambdaHack: A game engine focused on creating rouge-like dungeon crawlers like NetHack.

You can find a list of many, many more Haskell packages here on Hackage

Getting Started

There haven't been any getting started tutorials written for this yet! Have you had any experience with this language before? If so how about getting involved and help us fix this by contributing a guide for others to follow!

Tutorials

There haven't been any tutorials written for this yet! Have you had any experience with language before? If so how about getting involved and help us fix this by contributing a guide for others to follow!