
On Sat, Sep 02, 2006 at 09:51:26PM +0200, Benjamin Franksen wrote:
However, in order to 'run' (i.e. finally actually use) a monadic value that involves an application of bind, the latter would have to supply some argument to its second argument (which is a function),
If I didn't see above, only the following text...
so there must be some way to 'get an a out of' the first argument m.
I would answer: Yes, there is a method in Monad which has exactly this purpose: >>= I think I understand your confusion. Here are some non-controversial statements that may help you:
= is meant to be the only generic, primitive way of passing result from one monadic computation to another (there is also "join", but Haskell chose to derive it from >>=). It is a class method exactly because each monad should be able to use its own way of binding computations.
Programmers define the >>= method for their monads because they want to use it to bind computations. They know how to pass result(s) from one computation in their Monad to another, and they put this algorithm in the implementation of >>=. If they didn't care about passing results from one computation to the next one, they wouldn't be using monads in the first place. Best regards Tomasz