3 ms·
Not really. The big important part of monads is flattening/unnesting the output. Basically, if you can convert a `Foo<T>` into a `Foo<U>` by applying a functio
by orthoxerox 2y ago
Not really. The big important part of monads is flattening/unnesting the output.
Basically, if you can convert a `Foo<T>` into a `Foo<U>` by applying a function `T -> U`, it's a monoid. Think `map` or `fold`.
But if you can convert a `Foo<T>` into a `Foo<U>` by applying a function `T -> Foo<U>`, it's a monad. Flattening is "some logic", but not any logic, it's inherent to `Foo<>` itself.
- enugu 2y agoYour point on unnesting is apt but don't you mean functor instead of monoid?
- orthoxerox 2y agoYeah, you're right, I do. Thank you.