point-free icon indicating copy to clipboard operation
point-free copied to clipboard

Exception handling combinators

Open jackfirth opened this issue 10 years ago • 0 comments

with-handlers is less useful in a point-free context. Combinators are desired for following cases:

  1. Wrap function with predicate-handler pairs. Like with-handlers, but wrapping a function and producing a function, rather than wrapping an expression and evaluating the expression.
  2. Retry logic - wrap a function with a predicate recognizing exceptions and number of times retried, produce function that retries until the predicate returns false (either through the exception not being thrown or the number of retries being too high).
  3. Conversion of exceptions into "Either" type logic - a function throwing exceptions or returning a value can be turned into a function returning either a value or an exception value.

jackfirth avatar Feb 03 '16 00:02 jackfirth