haskell · quest — exhibition i – v

HASKELL

A quest through the marble halls of pure functional programming.

Est. MCMXC · Committee of Academics
Prologue

What is Haskell?

Born in 1990 from a committee of academics who valued purity over pragmatism, Haskell is a statically-typed, purely functional programming language — an experiment in treating computation as mathematics, and mathematics as architecture.

It is a language that has always existed slightly outside of time: every program is an expression, every expression is a proof, and every proof returns the same value when asked the same question. Nothing changes beneath the marble.

Interlude

Types & Purity

The type system is the pavilion's foundation. It is a discipline that narrows the universe of possible programs to those that cannot be wrong. Purity is its silence — no mutation, no hidden state, no unspoken consequence.

map :: (a -> b) -> [a] -> [b]
I
Chamber the First

Purity

A function in Haskell is a promise. Feed it the same argument at dawn and again at dusk — the marble will yield an identical answer. There is no hour, no weather, no state that can change its mind.

This is referential transparency: the law that an expression may be replaced by its value without disturbing the universe around it. Programs become equations. Equations become proofs.

What the outside world calls a side effect, Haskell regards as a rumor — and insists that rumors be typed, named, and carried in a container of their own.

double :: Int -> Int
double x = x * 2

II
Chamber the Second

TYPES

Every value wears a type like a signet ring. The compiler — courteous, tireless, implacable — refuses to join two rings that do not belong together.

a
Int
String
Bool
ℕ*
𝔹
data Shape = Circle Double | Square Double
III
Chamber the Third

MONADS

Maybe

A value that may or may not exist — uncertainty, caught in a marble tablet.

data Maybe a = Just a | Nothing

IO

The world itself, sealed in a container — every side effect traced and named.

putStrLn :: String -> IO ()

State

A thread of memory, carried by hand through an otherwise stateless hall.

get :: State s s

Reader

An environment, read silently — dependencies provided by the architecture.

ask :: Reader r r

Writer

A ledger accumulated as computation proceeds — a footnoted proof.

tell :: w -> Writer w ()

List

Nondeterminism made orderly — all possibilities held in a single expression.

[x | x <- xs, even x]
IV
Chamber the Fourth

Laziness

Haskell does not rush. An expression is not evaluated until its answer is actually needed — until a result is demanded, nothing is disturbed.

One may define an infinite list without alarm. The first ten elements will be conjured; the rest remain as possibilities, indistinguishable from silence.

primes = sieve [2..]
take 10 primes

A thunk is a promise to compute, slumbering in the marble. When forced, it wakes, delivers its value, and is replaced by the result — the forgetting is structural.

The page dims what you have already read — just as the runtime discards thunks it no longer requires.

V
Chamber the Fifth — Finale

Composition

f a function
g another function
(f . g) x = f (g x)

Every function is a marble tile.
Composition is architecture.