3 ms·
A monad is a mathematical abstraction. There's nothing special about Haskell that makes it work with monads. They work great in Javascript, C, Python... the syn
by agentultra 10y ago
A monad is a mathematical abstraction. There's nothing special about Haskell that makes it work with monads. They work great in Javascript, C, Python... the syntax of those languages don't make it terribly easy to work with them but it's still available. You have to be disciplined since you don't have the type system checking your work for you but you still get the benefits of the abstraction.
I'm presently trying to make this a little better in my own team's codebase by trying to introduce Flow [0]. There are a lack of definitions for the monadic libraries we use which I'm presently remedying. It's not pretty -- and my kingdom for OCaml or GHC! -- but it's better than not having it.
Knowing the fundamentals will help you learn to structure code and think clearly about abstractions. It's the difference between merely using something and understanding how it works. In the latter case you have the power to exploit it.
- deleted 10y ago[deleted]
- jwdunne 10y agoThe syntactic sugar is perhaps what's special. Code without that isn't so pretty. I do find it impressive, however, because it's based on an abstract, wide-ranging and extremely useful concept that can actually be expressed in the language without it. It follows the pattern that much syntactic sugar we take for granted has followed e.g a while loop is sugar on top of jumps and branching.