DEV Community

Discussion on: An introduction to Monads (in js)

Collapse
 
iquardt profile image
Iven Marquardt

It is hard to understand monads if you don't talk about applicatives. Monads are neither there to handle computaional effects nor side effects. Types like Maybe/IO do this. Functors are useful, because you can reuse your pure functions for all these types that handle computations with effects. Applicatives/Monads are useful, because you can compose several effectful computations. While applicatives don't assume an order these computations are evaluated in, monads do assume one.

Collapse
 
vonheikemen profile image
Heiker

It is hard to understand monads if you don't talk about applicatives.

I did write something after I mentioned pointed functors, but then I deleted that section.

Monads are neither there to handle computaional effects nor side effects. Types like Maybe/IO do this.

You're right, that's not the purpose of a monad, but they can be used to handle that sort of things. I mean, the types you mention Maybe and IO are an example of that. I guess that's just me trying to tell other people that monads aren't useless in javascript.

Collapse
 
iquardt profile image
Iven Marquardt

Most people need several years to really understand all facettes of Monads 'n stuff. During this journey they evolve different abstract representations in their head, where each becomes more accurate than the previous one. So there is really nothing wrong with your attempt to teach people the concept. I just wanted to point out some inaccuracies, that's all.