3 ms·
'Maybe' is both a monad and a sum. A monadic and an algebraic type at the same time. I wonder if there is an interesting interaction between those.
by Koshkin 5y ago
'Maybe' is both a monad and a sum. A monadic and an algebraic type at the same time. I wonder if there is an interesting interaction between those.
- black_knight 5y agoIn general an algebraic (polynomial) functor which is also a monad is called an operad (non-sigma operad for the algebraic topologists). They are plenty and have a lot of interesting structure.
- Twisol 5y agoMaybe is a sum because it was defined using sums. It's a monad because, from that definition, you can implement functions meeting the monad interface. "Monad" is more like an adjective than a noun. > I wonder if there is an interesting interaction between those. There's a rather rich theory of polynomial endofunctors (i.e. generic types with one type parameter built from products, sums, and non-generic types), and I think monads figure prominently (they're somehow related to the initial algebras for such functors). So there's definitely a relationship there.