haskell.day

A day for pure functions, elegant types, and fearless abstraction.

PAGE 01

What is Haskell

Haskell is a purely functional programming language with a static, strong, inferred type system. Every expression is a value; every function, pure. There are no side effects hiding in the shadows — only transformations from input to output, composed with the discipline of a writer painting letters at midnight.

-- A function that doubles a number
double :: Int -> Int
double x = x * 2
PAGE 02

Why Functional

Pure functions are immutable by nature — no variables being reassigned, no hidden state betraying your trust. Each function is a sealed contract between types, and the compiler is the enforcer. When you compose small, correct pieces, the whole program inherits that correctness. The art is in the composition.

-- Composition: (f . g) x = f (g x)
greet :: String -> String
greet = ("Hello, " ++) . (++ "!")
PAGE 03

Types as Style

A type signature is a declaration of intent, a tag left on the wall. It tells the world — and the compiler — what this function promises to do. Before you write a single line of code, you write the type. It is the outline sketched in the blackbook before the piece goes up on the freight.

-- Parametric polymorphism: works for any a
identity :: a -> a
identity x = x
PAGE 04

Lazy & Infinite

Haskell evaluates on demand — nothing is computed until it is needed. This allows you to define infinite lists and work with them piecewise, taking only the values you consume. The program is a blueprint for computation; the runtime is the spray-paint only hitting the wall where the light falls.

-- An infinite list, evaluated lazily
naturals :: [Int]
naturals = [1..]
take 5 naturals  -- [1,2,3,4,5]

The Constellation

Concepts as stars — hover to trace the wavefront.

TYPES ARE THE WALLS.

Functions are the paint. Composition is the art.