Currently I'm studing functional programming and I have a doubt about when should I use monads...
Is there some rule that I can use to know whenever to use it?
Currently I'm studing functional programming and I have a doubt about when should I use monads...
Is there some rule that I can use to know whenever to use it?
There is not a rule and it is not mandatory but failing to take advantage of monads may make your code harder to work with (e.g., callback hell, nested conditional branches, more verbosity). The essence of modern software development is composition, and monads make composition easier.
There is a very good article on medium covering the topic deeply:
https://medium.com/javascript-scene/javascript-monads-made-simple-7856be57bfe8