On Sat, Feb 23, 2013 at 10:58 PM, Kim-Ee Yeoh <ky3@atamo.com> wrote:
On Sat, Feb 23, 2013 at 7:27 AM, xiao Ling <lingxiao@seas.upenn.edu> wrote:

How do you define a function of signature h :: M Int -> M Int -> M Int  so that h ( M x ) ( M y ) = M ( x + y ), but without unwrapping the  value from the monad?

there seems to be a reservation about "unwrapping the value from the monad", which I don't get.

It's been pointed out to me that I've completely missed OP's question (which is really about variable names and their scope), my bad.

OP linked to sigfpe's article, which is what I should have been critiquing. Dan has contributed a lot of good material about Haskell, and I follow his blog closely. But the Trivial Monad article really isn't one of his best, and he perpetuates the faulty "wrapping" metaphor that seriously hampers Haskell productivity.

I'll write later explaining why and provide a better substitute.

-- Kim-Ee