I've read about four tutorials on monads so far, but it still escapes me.

In fact, I'm still not sure what problem it solves. I'm familiar with the 
problem of having, say, three functions like f(a) -> b, g(c) -> d, h(e) -> 
f, which you'd like to chain like f(g(h(x))), but you can't because b is a 
different type from c and d is a different type from e. The monad tutorials 
all start with a problem like this, but I still can't tell if they're 
actually providing a solution, because it appears every monad is specific 
to a particular type. E.g. a sequence monad. So, great, I have something 
that takes a scalar and returns a sequence. That might solve g(h(x)) if f 
is a scalar and c is a sequence by letting me write g(s(h(x))), but it 
doesn't solve the whole problem, since I still have f() to worry about.

So, two specific questions. First, do monads provide a generic solution, so 
I can apply f(g(h(x)))? Second, is it the whole point of monads to use 
macros so you don't see the glue functions, like s(), in my example? I 
mean, we can always write glue functions so we can compose functions with 
different input/output types without using monads. What exactly are monads 
adding?

Oh, and one more. If I were to actually use a monad in a piece of 
production code, what are the chances that the next person working on the 
code would have the faintest idea how it worked? ;-p

-- 
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

Reply via email to