Comment Comment by sznurek I wrote 'monad-inspired' structure because of lack of syntactic sugar (do notation). So it basically looks like that: login_action = Write('PASS') >> \ Read('pass') >> \ Guard(lambda v: v['pass'] == 'mysecret') >> \ Write('WELCOME') register(socket, login_action, on_success=func1, on_error=func2) Of course you can develop this idea futher: cat = Read('line') >> Write(lambda v: v['line']) cat.append_action(cat) register(socket, cat, on_error=handle_error_cb) parent sznurek 14 years ago