GLYPTOTHEK ANNEX
Nocturnal Acquisitions Bureau
VOL. VII · MMXXVI
After-Hours Edition
PLATE · I
PLATE · I
THE PURE FUNCTION
A specimen of unmediated mapping
id :: a -> a id x = x const :: a -> b -> a const x _ = x
- F.1Reflexivity
id ∘ f ≡ f - F.2Right Identity
f ∘ id ≡ f
A function in this register is not a procedure but a mapping: a finished correspondence between two sets, written once, never edited. It does not consult the world; it does not return on a Tuesday with different news. The kouros stands without a head because the head, like a side effect, was never the point.
See: Kahnweiler, "Notes sur la fonction pure" (Galerie Vollard, 1909) — though the manuscript is, like much of this collection, a fiction.
PLATE · II
PLATE · II
THE LAZY LIST
A specimen of postponed enumeration
data List a = Nil | Cons a (List a) repeat :: a -> List a repeat x = Cons x (repeat x) take :: Int -> List a -> List a take 0 _ = Nil take _ Nil = Nil take n (Cons x xs) = Cons x (take (n-1) xs)
- L.1Productivity
head (repeat x) ≡ x - L.2Termination by demand
take 0 ⊥ ≡ Nil - L.3Coinductive identity
repeat x ≡ Cons x (repeat x)
The lazy list is the aqueduct that runs forever because no one has yet asked the next stone for its weight. Demand, in this gallery, is the only force that can quarry a value from the dark. Until the visitor's hand is offered, the marble is content to remain unevaluated.
PLATE · III
PLATE · III
THE MONAD
A specimen of computational sequencing
class Applicative m => Monad m where
return :: a -> m a
(>>=) :: m a -> (a -> m b) -> m b
-- the kleisli composition
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
f >=> g = \x -> f x >>= g
- M.1Left Identity
return a >>= f ≡ f a - M.2Right Identity
m >>= return ≡ m - M.3Associativity
(m >>= f) >>= g ≡ m >>= (\x -> f x >>= g)
The amphora's neck is the bind: it is what lets one stage pour into the next without spilling the world. The pure value is poured in at the top and falls cleanly through the channel, but the channel itself remembers — every effect is carried in the curve of the clay.
PLATE · IV
PLATE · IV
THE FUNCTOR
A specimen of structure-preserving transport
class Functor f where
fmap :: (a -> b) -> f a -> f b
-- the contextual lift
(<$>) :: Functor f => (a -> b) -> f a -> f b
(<$>) = fmap
- U.1Identity
fmap id ≡ id - U.2Composition
fmap (g ∘ f) ≡ fmap g ∘ fmap f
The hand is the vessel of transport: whatever you place into it is carried, intact, from one column of meaning to another, without the hand itself being changed. The functor is the gesture, not the gripped thing.
Compare: Boulez, "Notations II — Sur la transposition de la forme" (Universal, 1980), in which an analogous idea is set in the upper voice.
PLATE · V
PLATE · V
THE TYPECLASS
A specimen of named obligation
class Eq a where
(==) :: a -> a -> Bool
(/=) :: a -> a -> Bool
x /= y = not (x == y)
class Eq a => Ord a where
compare :: a -> a -> Ordering
- T.1Reflexivity
x == x ≡ True - T.2Symmetry
x == y ≡ y == x - T.3Transitivity
x == y ∧ y == z ⇒ x == z
A typeclass is a vow of bearing. The caryatid does not say I am marble; she says I will hold the architrave. Any stone that takes that vow becomes, for the purposes of the temple, a caryatid. The contract is not the substance — it is the labour.
PLATE · VI
PLATE · VI
THE CATAMORPHISM
A specimen of generalized fold
cata :: Functor f => (f a -> a) -> Fix f -> a cata alg = alg . fmap (cata alg) . unFix -- Recovered as a fold over List foldr :: (a -> b -> b) -> b -> [a] -> b foldr _ z [] = z foldr f z (x:xs) = f x (foldr f z xs)
- C.1Universal property
h ≡ cata φ ⇔ h ∘ in ≡ φ ∘ fmap h - C.2Fusion
g ∘ cata φ ≡ cata ψ when g ∘ φ ≡ ψ ∘ fmap g - C.3Reflection
cata in ≡ id
The chimera is a fold. Lion, goat, serpent — three algebras laid one against the next, each consuming the previous shape and returning a new one. By the time you reach her teeth, the lion is gone; only the bronze that was lion remains, recombined.
PLATE · VII
PLATE · VII
THE FINAL COALGEBRA
A specimen of unbounded continuation
data Stream a = a :> Stream a ana :: Functor f => (a -> f a) -> a -> Nu f ana coalg = wrap . fmap (ana coalg) . coalg unfold :: (b -> (a, b)) -> b -> Stream a unfold f b = let (a, b') = f b in a :> unfold f b'
- N.1Universal property
h ≡ ana ψ ⇔ out ∘ h ≡ fmap h ∘ ψ - N.2Reflection
ana out ≡ id - N.3Productivity
head (unfold f b) is well-defined for total f
The pedestal is empty because the specimen has not stopped arriving. A coalgebra is the law of the next step; the final coalgebra is the law that is large enough to contain every step that follows. The visitor leaves the gallery, but the catalog continues — somewhere, an unobserved register is still incrementing.