an almanac in six hours

haskell.day

A single ceremonial day, observed once a year, the way astronomers observe a transit. Read slowly. Nothing is hurried.

52°N · 04°E · pre‑dawn · the long shore

i · the first hour

Dawn

Before the colour of the sea is decided, a long-legged bird stands on the threshold of two cells, considering whether to lift its leg.

It is the hour at which everything is still possibility. Across the shallow water the heron's silhouette is read as a single uninterrupted stroke — head, neck, body, leg — and where its eye should be there is instead a small λ, a folded pair of lines that has decided to mean function. The bird does not call this anything. It simply lambda the morning into being, and the morning, lazily, complies. There is no need yet for evaluation; the day has been promised but not yet summoned. We watch the heron lift one leg, very slowly, and put it down again, and we understand the unhurried covenant of pure functions.

λ
the lambda heron — Ardea λ

ii · the second hour

First Tide

The water arrives without announcing itself. It enters the cell from the right, slow and oblique, the way a sentence arrives at its meaning. At First Tide the foldr walks down a folded ribbon of paper, taking the rightmost crease in its hand and bringing it to meet the next, and the next, until the whole ribbon has become a single point of accumulation. The naturalist's footnote, set in the margin, is brief: a fold is not a loop, it is a procession. We watch each crease arrive in its turn and we understand the day is being assembled from its end backwards toward us.

[] : : : : : []
foldr — a procession of creases, gathered from the right.

iii · the third hour

High Sun

At the highest hour of the day the light is dim, oceanic, and there is no hurry. Across the upper third of the cell a slow wedge of pale paper is moving — almost imperceptibly — from left to right. It is a glacier, and beneath it a faint trailing line is being drawn in the colour of low cloud. Read the line as the type. The wedge does not declare itself. It does not announce inferType at the door; it simply walks, and the line behind it walks too, and you discover, at the end of the hour, that something has been written. The type creeps forward of its own accord. Stay here a while. The glacier moves only when you read.

the type creeps forward of its own accord
the glacier of inference — moves while you dwell.

iv · the fourth hour

Low Sun

The sun has tilted now and the water inside the apothecary jar — which has been on the table since morning — is rising and falling on a long quiet breath. Above the jar floats the legend IO (), set very small. Inside the jar are the day's effects: a salted gust of wind, the scrape of a chair, the action of having spoken. Each effect is held by the glass and only the glass; outside it the prose remains pure. We watch the level rise and we understand that readLine is not an act of will but a contract. The lid rocks gently, ±0.6°, as if the table itself were on a small slow boat.

IO ()
the tide jar — effects, contained.

v · the fifth hour

Twilight

At the edge of the cell, a five-armed starfish has its arms steepled like the fingers of a person thinking. The center of the starfish is stamped, in a careful hand, with the word Functor. We are entering the hour of small mappings. To fmap over the day is to lift each gesture, intact, into its container — the gull's call into the air, the silt into the tide, the syllable into the sentence — without disturbing the shape of any of them. Twilight is the hour of equivalence under structure. The light dims, and yet what was carried through the day arrives at evening unbroken, in the same posture it had at noon.

Functor
the steepled starfish — five arms, one mapping.

vi · the sixth hour

Night

The day closes by being lifted into the sky. Above the long shore the typeclasses appear as a small constellation, its lines so thin they could be a held breath. Eq arrives first, low and steady; Ord rises over its shoulder; Monad, late and unhurried, opens at the zenith; Applicative, Foldable, Traversable, Functor, Semigroup, all the rest, take up their places. To unfoldr the night is to read each star in its turn back into the seed it came from. The almanac closes here. The next hour is morning, again. To be present, simply arrive.

Eq Ord Show Read Functor Applicative Monad MonadFix Semigroup Monoid Foldable Traversable Alternative Category
the star-map of typeclasses — fourteen lights, one almanac.