On Mon, 2012-01-02 at 05:18 -0800, Dragan R wrote: > and are monads realy useful in impure functional languages like > clojure?
Clojure's impurity doesn't mean that we wouldn't like to avoid side-effecty ways of doing stuff. Monads can help you there, among other things. The monad idea captures a very high-level abstraction, giving you the stuff that is implemented on that idea for free. For example, if you want an idea of `map' for your data structure, you'll get m-fmap if you write a monad instance. Some of this stuff seeps into more commonplace operators. `for' is essentially a sugary and faster `domonad sequence-m'. Likewise, the terribly useful `-?>' from core.incubator is much like `((with-monad maybe-m (m-chain [...])) start)'. That said, Haskell-style evaluation and type inference does make them more useful and easier to use. > I would like to know do you use Monads in your real clojure > applications, Aside from `-?>' and `for', I've implemented one custom monad instance for a production Clojure application. No doubt some of the stuff I've done with dynamic vars would have been cleaner with the reader monad; https://github.com/straszheimjeffrey/The-Kiln will, I think, be a good use case for the reader monad when it's ready. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- 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