I know monads are available in clojure, but has anyone verified that they work in clojurescript?
Monads work in clojurescript. The only thing is the way you reference macros in clojurescript [1].
What I did is copy all tools/macro.clj and all the monads.clj code into a big file which I then reference from clojurescript.
It's perhaps not the most elegant way but it works.
You can find the file in https://github.com/cotarmanach/clojurescript-monad-macros (I copy it in my project and change the namespace to be the one of my project)
[1] See https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure
ClojureScript's macros are written in Clojure, and are referenced via the require-macros keyword in namespace declarations:
(ns my.namespace (:require-macros [my.macros :as my])) The :as prefix selector is required in :require-macros. One point of note is that the code generated by ClojureScript macros must target the capabilities in ClojureScript.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With