Generalisation of the thread macro to all monads.