> Is there more to it than, "Monadic functions must return monadic > values"? > > Any clarifying advice would be welcome. >
Gah, I already wrote a reply, but looks like I lost it somehow. To summarise: I think one of the main benefits of the monad abstraction is the uniformity of all monads. ie. all monad functions have the type a -> m b What this means is that you can write functions which work under arbitrary monads, as long as they use the generic monad functions. For example, a monadic inc: (defn minc [v] (m-result (inc v)) This function works in any monad, and threads the state properly, even though it's never mentioned. A function that actually does care about the state will just access it by returning a "custom" state monad value (a function of s). -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en