F# computation expression based on railway programming http://fsharpforfunandprofit.com/posts/recipe-part2/
https://www.nuget.org/packages/AttemptIt
- Attempt<'TSuccess, 'TFail> represents an attempt at doing something
- Result<'TSuccess, 'TFail> represents the result of an attempt
Basic usage
let doThis = attempt {
let! x = someFunc()
let! y = someOtherFunc y
return! finalFunc y
}
Catching Exceptions
let exceptionHandler (e:exn) -> Fail e.Message
let tryThis = Attempt.Catch exceptionHandler doThis
Evaluating
let result = Attempt.Run tryThis