Haskell

Updated: 05/06/2024 by Computer Hope
haskell programming language

Haskell is a programming language created in 1990. It is a general-purpose language named after Haskell Curry, an American mathematician famous for his contributions to the field of combinatory logic.

Haskell's features

  • Lazy evaluation — Haskell only evaluates expressions when the value is needed for a calculation. It was one of the first languages to employ this evaluation strategy. Before Haskell, most programming languages used "eager evaluation," where an expression is evaluated as soon as it is bound to a variable. Lazy evaluation can offer better performance and permits the definition of data structures with no size limit.
  • Pure functions — In Haskell, functions are "pure," meaning that the return value is always the same for a given input. Unlike functions in other programming languages, a Haskell function cannot cause side effects to variables outside its lexical scope. This restriction can simplify the code's development, debugging, and refactoring.
  • Strong, static typing — Once a variable is declared as a certain data type in Haskell, it cannot be used as another. This limitation requires a more stringent programming style but provides the performance benefits of the compiled code.

Major updates

  • Haskell 98, released in late 1997, included a special standard library for teaching purposes and a framework for future extensions.
  • Haskell Prime, launched in 2006, is an ongoing, formal, open process for refining Haskell's language specification.
  • Haskell 2010 added a feature known as the FFI (Foreign Function Interface), which allowed Haskell programs to use the functionality of other programming languages.

Hello, World! in Haskell

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

Data type, Functional programming, General-purpose language, Hello World, Programming terms, TLA