Saltar al contenido ForoHackers

Haskell: start here

Haskell
#3077 · · Citar · Denunciar

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

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder