Haskell (programming language)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Haskell is a purely functional programming language. It is named after Haskell Brooks Curry, a U.S. mathematician who contributed a lot to logic. Haskell is based on lambda calculus and uses the Greek letter lambda as its logo. The main implementations are the Glasgow Haskell Compiler (GHC), and Hugs, a Haskell interpreter.

Examples [change]

The following is an example Hello World program in Haskell:

module Main where
 
main :: IO ()
main = putStrLn "Hello, World!"

One way to create an infinite list of Fibonacci numbers is this:[1]

fib n = fibs !! n
        where fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

References [change]

  1. "The Fibonacci sequence". HaskellWiki. 2 August 2012. http://www.haskell.org/haskellwiki/index.php?title=The_Fibonacci_sequence&oldid=47800. Retrieved 27 March 2013.