3 ms·
The IO and State monads is specifically to solve the problem of side effects in a purely functional language, so they are not really relevant in other languages
by olavk 12y ago
The IO and State monads is specifically to solve the problem of side effects in a purely functional language, so they are not really relevant in other languages.
But other uses of monads, like say monadic parsers could be useful in other languages. And list comprehensions is also based on a monad in Haskell - this functionality is clearly useful in many other languages.
But without some kind of syntactic sugar (like do-notation in Haskell) the use of monads becomes far to cumbersome, and it ends up being easier to solve the same problem in an ad-hoc manner.
- fubarred 12y agoCheck out https://youtu.be/xKRndVoo2ms https://youtu.be/xKRndVoo2ms, it explains how monads can refactor messy things like call chaining if you're building SQL-like result interfaces.