Skip to the content ForoHackers
Log inJoin

Haskell: start here

Haskell
#3077 · · Quote · Report

Haskell is a purely functional, lazily evaluated language with a powerful static type system. Side effects are tracked in types, so most of a program is pure and easy to reason about. It is a research and teaching favourite and a source of ideas that other languages borrow, and it is used in compilers, finance and tools where correctness matters.

Key concepts

  • Purity: functions have no side effects; effects such as input and output appear in the type.
  • Laziness: expressions are evaluated only when their value is needed, allowing infinite structures and new control forms.
  • Type inference and algebraic data types: the compiler infers most types; data is built from sums and products.
  • Type classes: overloaded behaviour defined per type, the basis of Functor, Monad and friends.
  • Monads and effects: a general interface for sequencing computations with context.
  • Immutability and recursion: no loops with mutable counters; folds and recursion instead.

Vocabulary

  • Monad: a type with operations to sequence steps that carry context, such as failure or state.
  • Thunk: a delayed computation waiting to be evaluated.
  • Point-free style: defining functions by composition without naming arguments.
  • Cabal and Stack: build and package tools for Haskell projects.

What to study, in order

  1. Expressions, functions, lists and recursion in the interactive interpreter.
  2. Types, type signatures, data declarations and pattern matching.
  3. Higher-order functions, folds and list comprehensions on small problems.
  4. Type classes, Maybe and Either, then Functor, Applicative and Monad.
  5. Input and output, and a small program such as a parser or a text tool.
  6. Laziness and its costs: space leaks and how to find them.

Related tags

#functional-programming #type-theory #ocaml #compilers

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply