Functional helpers for callback based code.