On Fri, 2012-10-26 at 09:06 -0700, Brian Craft wrote:
> First, do monads provide a generic solution, so I can apply
> f(g(h(x)))?

Yes.  control.algo.monads provides it as m-chain.

The closest equivalent to m-chain in Haskell is (foldl' (>=>) return),
but in most situations you would favor f =<< g =<< h x for your example,
or more compositionally (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.

We can always write things out explicitly instead of exploiting existing
abstractions.  As for macros, the above samples use ordinary Haskell
function calls.


-- 
Stephen Compall
"^aCollection allSatisfy: [:each | aCondition]": less is better than


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