Just what the internet needed: another attempt to explain #monads! ๐ But this time I'm comparing #Haskell and #OCaml approaches to show why #typeclasses make all the difference. Turns out those JavaScript Promise analogies only tell half the storyโฆ
@hongminheeๆดช ๆฐๆ (Hong Minhee)
Agree with most of this, but it's slightly unfair to compare the syntaxes, when "let*" in ocaml can make it look closer to Haskell's "do" blocks. After all, "do" is simply (a nice) syntactic sugar for those same chained binds and lambdas, and you could write the Haskell in that style too. Fwiw, I've gone in the other direction over time, from Haskell to Ocaml, partly because the typeclasses make type inference harder and the resulting compiler errors so much less clear.
If you have a fediverse account, you can quote this note from your own instance. Search https://hachyderm.io/users/sanityinc/statuses/114137361421877751 on your instance and quote it. (Note that quoting is not supported in Mastodon.)