Snippets tagged extcore

  • "Guard" helper function for railway error handling

    Defines a "guard" function for railway-style error handing which allows you to concisely verify a condition when handling errors using Choice<'T, 'Error>. It checks the condition and if it is false, returns Choice2Of2 with the specified error value. If the condition is true then it returns Choice1Of2 (). Loosely inspired by Swift 2.0's guard keyword.

    2 people like this

    Posted: 8 years ago by Anton Tcholakov