Monad.ml1 2 3 4 5 6 7 8 9 10 11 12 13 14(* Lwt promises *) type 'a t = 'a Lwt.t let return = Lwt.return let bind = Lwt.bind let catch func handler = Lwt.catch func (fun exn -> (* TODO: need to capture the stack trace earlier? How? *) let trace = Printexc.get_raw_backtrace () in handler exn trace)