4 ms·
You're mentioning Clojure. Clojure has protocols which are probably inspired by type classes. Just like Clojure's protocols, type classes are a mechanism for a
by bad_user 9y ago
You're mentioning Clojure.
Clojure has protocols which are probably inspired by type classes. Just like Clojure's protocols, type classes are a mechanism for ad hoc polymorphism that allows decoupling between data and the functions operating on that data.
Clojure indeed doesn't have monads, but this has to do with Clojure's culture (like all LISPs) of using macros for describing APIs for composing stuff. But those APIs aren't unified and some of the DSLs I've seen do not have a theoretical foundation, which really means they aren't reusable and some of them are flawed.
Due to its evolution and backwards compatibility concerns, some of its design shows its age as well. You can't make operations like "map" work on your own data types because it doesn't have a protocol defined for it.
Don't get me wrong, I actually like Clojure, but that the community is not using types like monads to drive their design is a flaw.
- slowmovintarget 9y agoWhat do you mean by "doesn't have monads?" You just write monads in Clojure. They are only a structural formalism. [1] If you meant doesn't have the Maybe monad built in... why would you want that tangled up in your data? [2] [1] https://github.com/khinsen/monads-in-clojure/blob/master/PART1.md [2] https://youtu.be/2V1FtfBDsLU?t=2381