///<summary> ///Returns an action which attempts <paramref name="action"/> first and does ///<paramref name="ifFirstActionFails"/> if it fails. ///</summary> ///<param name="action">The action to try.</param> ///<param name="ifFirstActionFails">The action to do if <paramref name="action"/> ///fails.</param> ///<typeparam name="T"></typeparam> ///<returns></returns> public static ActionCPS <T> OrElse <T>(this ActionCPS <T> action, ActionCPS <T> ifFirstActionFails) { return(action.WithRescue(e => ifFirstActionFails)); }
///<summary> ///Returns an action which attempts <paramref name="action"/> first, returns <paramref name="defaultResult"/> if /// it fails. ///</summary> ///<param name="action">The action to try.</param> ///<param name="defaultResult">The result if <paramref name="action"/> fails.</param> public static ActionCPS <T> WithDefault <T>(this ActionCPS <T> action, T defaultResult) { return(action.WithRescue(e => Return(defaultResult))); }