What Is Haskell?
Haskell is a purely functional programming language with a strong, static type system and lazy evaluation. It was designed by a committee of researchers starting in 1987 and named after the logician Haskell Curry. The current language standard is Haskell 2010, and in practice almost everyone uses the GHC compiler (the Glasgow Haskell Compiler).
main :: IO ()
main = do
let languages = ["Haskell", "OCaml", "Elm", "Scala"]
short = filter (\name -> length name <= 5) languages
print short
print (map length languages)
["OCaml","Elm","Scala"]
[7,5,3,5]
Its defining traits:
- Purely functional — functions behave like mathematical functions: the same input always gives the same output, and they can't secretly change variables, print, or read files. Effects such as I/O are tracked in the type system.
- Immutable data — once a value exists, it never changes. You build new values instead of modifying old ones.
- Statically typed with type inference — every expression has a type checked at compile time, but you rarely have to write types, because the compiler works them out.
- Lazy — expressions are evaluated only when their results are needed, which makes infinite lists and custom control structures possible.
- Compiled to native code — GHC produces fast executables, and also ships an interactive interpreter, GHCi.
This course teaches Haskell as it is written today with GHC 9.x (examples were run on GHC 9.14.1). Everything in Level 1 and Level 2 also works on older GHC versions you may find in tutorials and on servers.