Introduction to Haskell

1.1 What is Haskell?

Haskell is a purely functional, lazily evaluated, statically typed general-purpose language with type inference. It's named after the logician Haskell Curry.

It was designed by a committee starting in 1987 to consolidate lazy functional languages. Standards: Haskell 98, Haskell 2010. Today's de facto standard is GHC (Glasgow Haskell Compiler) with language editions GHC2021 and GHC2024.

1.2 Key Features

Functions have no side effects; same input → same output (referential transparency)

Values never change; "variables" are names bound to values Expressions are evaluated only when needed (enables infinite data structures) Strong static typing

Many bugs are caught at compile time; "if it compiles, it usually works" Type inference

Hindley–Milner-based: types are often inferred without annotations Type classes

Principled ad-hoc polymorphism (Eq, Ord, Show, Functor, Monad...) Algebraic data types

Sum and product types with pattern matching Effects in types

Side effects are tracked by types (IO), so they're explicit

Lightweight green threads, STM, excellent runtime Expressive type system

GADTs, type families, rank-N types, DataKinds, linear types

1.3 Where Haskell Is Used

Industry: Meta (Sigma spam-fighting system, Haxl), GitHub (Semantic code analysis), Standard Chartered (Mu), Mercury (banking), IOG (Cardano blockchain), Tweag, Well-Typed, Serokell, Hasura (GraphQL engine, earlier versions), NoRedInk, Juspay (payments), Galois (high-assurance software), Bellroy, Scrive, and many fintech/crypto firms.

Tools: Pandoc (document converter), ShellCheck, xmonad (window manager), Darcs, Elm compiler, PureScript compiler, Agda, Idris 1, hledger, PostgREST, Dhall.

Domains: compilers and DSLs, finance, blockchain, formal verification, backend web services, data processing, research.

1.4 Functional vs Imperative Thinking

Functional (Haskell) Statements that change state Expressions that compute values Loops (for, while) Recursion, map, filter, fold Objects with behavior Data types + functions over them Exceptions for control flow Maybe/Either values Side effects anywhere

Effects isolated in IO (and other monads)