The water
changes
temperature.
A layer of sudden cold, where the easy surface metaphors stop working and the sea reveals it has been composing itself all along. Here, the first monad arrives — not as an abstraction but as a rhythm of dependent steps.
(>>=) :: m a -> (a -> m b) -> m b
λ
λ
class Functor f where
fmap :: (a -> b)
-> f a
-> f b
class Functor f
=> Applicative f where
pure :: a -> f a
(<*>) :: f (a -> b)
-> f a
-> f b
an applicative is a functor
that has learned to hold
its own breath.
We lift pure values into the current. We zip two floating things and make them speak.
IO ()
A shape that performs. The only vertebrate in the phylum.
λ
Monadic chains,
like kelp forests,
sway in sequence.
do
name <- readLine
depth <- sense
pure (descend name depth)
Each line is a frond. The frond above cannot see the frond below — it only yields, and trusts.
the compiler is a very
patient marine biologist.
Functor Laws
fmap id = id
fmap (f . g) = fmap f . fmap g
Identity. Composition. Two laws, no more, no less — a coral the right size.