Solutions to the exercises of DaoFP, Chapter 15: DaoFP Chapter 15 Exercises. Index: Map of Content.
Solution 15.1.1
The second identity is : reading bottom-up, . As a string diagram: an -string that dips into a cup (, creating to its right) and then rises through a cap (, annihilating ) — a zigzag that pulls straight to the plain -string. When is a Haskell endofunctor: triangle2 :: forall x. L x -> L x; triangle2 = counit . fmap unit, which must equal id (here fmap is ‘s, instantiating ; counit at L x is ).
Sources: DaoFP Exercise 15.1.1.
Solution 15.2.1
Replace every -string by the parallel pair . Then is a cup and is a cap between the inner and of two adjacent pairs. Left unit : a cup on the left of an pair followed by the cap joining the cup’s with the pair’s — the … zigzag straightens by the first triangle identity, leaving . Right unit: symmetric, using the second triangle identity. Associativity: three pairs with two caps; applying the caps left-first or right-first yields the same diagram since caps on disjoint strings can slide past each other (interchange law).
Sources: DaoFP Exercise 15.2.1.
Solution 15.3.1
and forgets the point, so Maybe a. The unit is (Just); the counit at a pointed object is the point-preserving map ; whiskering gives , i.e. join Nothing = Nothing; join (Just m) = m — exactly the Maybe monad. The adjunction: a point-preserving map is determined by its restriction to , so .
Sources: DaoFP Exercise 15.3.1.