Haskell is a programming language first introduced 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.
- Lazy evaluation — Haskell only evaluates expressions when the value is actually needed for a calculation. It was one of the first languages to employ this type of evaluation strategy. Until Haskell, most programming languages used "eager evaluation", in which 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 that have no size limit.
- Pure functions — In Haskell, functions are "pure," meaning they are guaranteed to always return the same result for a given set of input. The return value of a function never varies due to the changing state of information outside of the function and cannot have side effects on data outside the scope of the function. This restriction has the benefit of simplifying debugging, and making it easier to predict a program's real-world behavior.
- Strong, static typing — Once a variable is declared as a certain data type in Haskell, it cannot be used as if it were another data type. This limitation requires a more stringent programming style, but allows for performance benefits of the compiled code.
- Haskell 98, which was released in late 1997, included a special standard library for teaching purposes and a framework for future extensions.
- Haskel Prime, which was released in 2006, significantly updating the language specification.
- Haskell 2010 added a feature known as the foreign function interface (FFI), 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!"