On Fri, Oct 26, 2012 at 8:39 PM, Stephen Compall
<stephen.comp...@gmail.com> wrote:
> 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.

Can you expand on this? If the functions are

f :: a -> b
g :: c -> d
h :: e -> j [renamed from "f"]

and "you'd like to chain [them] 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.", how
does m-chain help?

I would have expected, given the "b is a different type from c" thing,
that the chaining would go h(g(f(x)), but it's not as if that helps,
unless the types work out like:

b ~ m c
d ~ m e

in which case f >=> g >=> h :: a -> j works fine (assuming j is a
monadic value). But as a general matter I don't see how monadic
composition solves the problem.

-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks,
which may be sweet, aromatic, fermented or spirit-based. ... Family
and social life also offer numerous other occasions to consume drinks
for pleasure." [Larousse, "Drink" entry]

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