|
|
|
|
|
by creata
1876 days ago
|
|
> It doesn't compose with other abstractions But monads don't compose with each other, do they? I thought you needed something more (monad transformers, algebraic effects, etc.) to get things to compose. Or maybe you meant something else by composition. > I can't use this for my own abstractions Yep. But Java doesn't even let you overload addition afaik, so being able to overload ? is pretty much a pipe dream. > Do you mean that, because you don't see people lamenting, it's not a useful feature? No, it's just that if something "backfired" for Java, I'd expect to hear people complaining about it. |
|
They do if they're[0] traversable (cf literally `Data.Traversable` in Haskell), which almost all specific monads are. You'd have something like:
Edit: 0: actually, only the inner monad needs to be traversable.