Let me use my favourite tool of intellectual terrorism: Just use monads. Ouch, now we have two problems here. :P
I believe the paper of Wadler makes this most clear. Some time ago, it was a real eye-opener for me:
http://homepages.inf.ed.ac.uk/wadler/papers/essence/essence....