|
|
|
|
|
by embwbam
1069 days ago
|
|
They’re like promises or futures, but limited to chaining only one type of thing: Maybe (optionals) - chain steps and abort if any step is empty. IO - perform IO side effects, and run the next step when this one completes. Just like a async/await. You use monads all the time in other languages! Haskell just has many more kinds and allows the programmer to make their own. I always twitch when I hear someone say you can’t both understand and teach them. Did I succeed? Also note that you don’t have to totally understand monad machinery to use them productively, only to write your own. |
|
No you don't. You are confusing monads with features which can be implemented using monads. In Haskell monads are used for modeling side effects, but this is not the case in other languages. In Haskell exceptions are implemented using monads, but this is not the case in other languages.