Re: Do you use Monads in your real clojure applications

2012-01-04 Thread Thorsten Wilms
On 01/04/2012 03:05 AM, Takahiro Hozumi wrote: In MVC pattern, Model should take responsibility for business logic. Therefore I write validate function for creating in the model. If creating a instance of the model should be safe, I must validate a parameter in the create function. My problem is

Re: Do you use Monads in your real clojure applications

2012-01-04 Thread Meikel Brandmeyer
Hi, Am 04.01.2012 um 10:12 schrieb Thorsten Wilms: (defn handler [{:keys [params] :as req}] (if (person/valid? params) {:status 200 :body (json/generate-string (person/create params))} {:status 400})) Or you let the create function return nil on invalid params. (defn handler

Re: Do you use Monads in your real clojure applications

2012-01-04 Thread Dragan R
Thanks to all authors for help. Best regards, Dragan Radevic -- 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

Re: Do you use Monads in your real clojure applications

2012-01-04 Thread Dragan R
Thank you for your great answer Konrad. On Jan 3, 9:46 am, googlegro...@khinsen.fastmail.net wrote: Dragan R writes:   On the net I read that Impure functional programming doesn't really   need monads.   and It appears that in the presence of mutable state, a lot of the   advantages of

Do you use Monads in your real clojure applications

2012-01-03 Thread googlegroups
Dragan R writes: On the net I read that Impure functional programming doesn't really need monads. and It appears that in the presence of mutable state, a lot of the advantages of monads become moot. Monads are an abstraction mechanism, so you never need them. You can always use the

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread Meikel Brandmeyer
Hi, I used monads in two projects. * The last rewrite of ClojureQL before v1.0 used a state monad to keep track of various things during query creation. * ClojureCheck also uses a monad approach to create and combine generators for test data. * Dave Ray and I tried a monad style in the async

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread Philip Potter
On 3 January 2012 08:46, googlegro...@khinsen.fastmail.net wrote: Dragan R writes:   On the net I read that Impure functional programming doesn't really   need monads.   and It appears that in the presence of mutable state, a lot of the   advantages of monads become moot. Monads are an

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread Lee Hinman
We use monads within one of our work project, but not to any large amount. It mostly boils down to using the Maybe monad to avoid giant nested if- lets. - Lee Hinman -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread jim
On Jan 3, 2:46 am, googlegro...@khinsen.fastmail.net wrote: I probably use monad more than the average programme in my own code, but that's also because I happen to be familiar with them. I could very well live with fewer monads in my code. But once you know monads, they appear magically

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread Mark Engelberg
Some of the most common uses for monads have pre-existing mechanisms with Clojure to handle them, e.g.: sequence monad (for) state monad (Clojure has many stateful mechansisms) maybe monad (Clojure programmers usually just return nil for failure, and use something like when-let to process it) In

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread Takahiro Hozumi
In MVC pattern, Model should take responsibility for business logic. Therefore I write validate function for creating in the model. If creating a instance of the model should be safe, I must validate a parameter in the create function. My problem is that a controller have to validate a parameter

Do you use Monads in your real clojure applications

2012-01-02 Thread Dragan R
Hello, I would like to know do you use Monads in your real clojure applications, and are monads realy useful in impure functional languages like clojure? On the net I read that Impure functional programming doesn't really need monads. and It appears that in the presence of mutable state, a lot

Re: Do you use Monads in your real clojure applications

2012-01-02 Thread Stephen Compall
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

Re: Do you use Monads in your real clojure applications

2012-01-02 Thread Alex Baranosky
Midje has some of its error handling code implemented with a monad. https://github.com/marick/Midje/blob/master/src/midje/error_handling/monadic.clj#L32 `error-let` is like a regular let, except if there is a validation-error, that error short-circuits out. Alex -- You received this message