Monads and interaction, MGS 2021
Exercise class 4
1. Show two func-func interaction laws (F0, G0, phi0), (F1, G1, phi1)
canonically induce an interaction law
(F0 x F1, G0 + G1, ...)
(Show that this interaction law is the product of the two interaction
laws.)
Show that this construction also works the same way for mnd-comnd
interaction laws.
2. Show a func-func interaction law (F, G, phi) canonically induces a
mnd-comnd interaction law (F*, G+, ...).
(Show that this mnd-comnd interaction law is the free one on the
given func-func interaction law.)
3. Show that mnd-comnd interaction laws between a free monad F* and a
comonad D are in a bijective correspondence with func-func interaction
laws between F and UD (=the underlying functor of D).
4. Spell out (say, in Haskell) the canonical interaction law between
the state functor
St^S X = S => S x X
and its dual.
Spell out the canonical interaction law between the state monad and
its Sweedler dual.
Compare and try to see understand what's happening.
4'. Do the same for the nonempty list functor and monad.
5. Define a R-residual monad-comonad interaction law between T, D for
T - the intensional nullary-binary nondeterminism monad
D - the Sweedler dual for the binary nondeterminism comonad
R - the maybe monad
5'. Do the same for
T - the delay monad
D - the nonempty list comonad
(think of environments here timing out timed computations)
R - the delay monad
6. An R-resid mnd-comnd int laws between T, D gives you a functor from
(Coalg(D))^op x Alg(R) to Alg(T).
Use this to produce a functor that turns a lens structure on S into a
mnemoid structure on S => Z.