I assume, @gbuday, that “binding function” refers to the function on the right side of >>=
. So where m
represents the monad constructor, here is an illustration:
(m a) >>= (\x -> ...)
The “binding function” is (\x -> ...)
. This is where a
gets bound to x
. (I added unnecessary parentheses for the sake of absolute clarity.)
The “logic [added] to the binding function” is what you would use to replace the three dots. You can do pretty much anything you want with x
in this part of the function. The only rule is that in the end the function (\x -> ...)
must return an instance of the monad m
. That is, it must return something in the same “container”. (That’s required by the type of >>=
.)
I am not an expert on Haskell, and it may be that there are technical refinements needed to make what I said fully correct, but I think it is a good entry point to an answer to what you were asking. I thought it might be worthwhile to give an answer from my point of view, even though I am not an expert, because I think I may be close to the mindset that led to the question. (Or it could be that I am just telling you a lot of things you already know, and that I misunderstood the question.)