3 ms·
For context, this is a special case of Haskell's monads, which was also adopted by languages like Swift.
by modalduality 10y ago
For context, this is a special case of Haskell's monads, which was also adopted by languages like Swift.
- aaron-santos 10y agoReminiscent of Clojure's get-in function as well. [1] [1] https://clojuredocs.org/clojure.core/get-in https://clojuredocs.org/clojure.core/get-in
- emidln 10y agoThis is more like a clojure macro in that it runs via a compiler extension to avoid the runtime call overhead of something like get-in. Seeing how verbose and painful it looks, it's also an interesting commentary on macros in JS.
- lacker 10y agoI wonder if there are other useful monads that would be useful to add to JavaScript.
- belovedeagle 10y agoJavaScript already has monads, whether or not they are recognized as such. What JavaScript needs is either Haskell's syntactic sugar for monads, or, much much better, lisp-style (as opposed to cpp or m4) macros which can be used to implement that sugar directly. The macros could even be run during a one-time "compile" step on the server before being served; or not, if the cost of expanding them is less than the cost of sending expanded code over the network.