Diagram showing how a list monad can be used to compose complex roots of a number. sqrt and cbrt are, respectively, the complex multivalued square and cube root functions. When composed with the "bind" operator "•" they produce the sixth root function. Here z is a complex number, and the square brackets denote an array.
unit(z) := [ z ]
‌
(f•g)(z) := append(map(f,g(z)))
‌
lift(f) = f° := unit•f = f•unit
‌
sqrt°(z) =
= append(map(unit,sqrt(z)))
= append(map(sqrt,unit(z)))
‌
sxrt(z) = (cbrt°•sqrt°)(z)
= append(map(cbrt°,sqrt°(z)))
Own work
BrightR