README
FsToolkit.ErrorHandling is a utility library to work with the Result
type in F#, and allows you to do clear, simple and powerful error handling.
The library provides utility functions like map
, bind
, apply
, traverse
, sequence
as well as computation expressions and infix operators to work with Result<'a, 'b>
, Result<'a option, 'b>
, Async<Result<'a, 'b>>
, Async<Result<'a option, 'b>>
, and Result<'a, 'b list>
.
With adding a reference to FsToolkit.ErrorHandling.TaskResult
you will also have access to computation expressions and infix operators related to Task<Result<'a, 'b>>
.
It was inspired by Chessie and Cvdm.ErrorHandling (the latter has now been merged into FsToolkit.ErrorHandling).
FsToolkit.ErrorHandling targets .NET Standard 2.0 and .NET Framework 4.6.1 and supports Fable.
Nuget
Note
This documentation assumes some familiarity with standard functions like map
, apply
, bind
, traverse
and sequence
and the problem these functions solve. If this is new to you, check out Scott Wlaschin’s excellent tutorial on the subject.
A motivating example
This example of composing a login flow shows one example of how this library can aid in clear, simple, and powerful error handling, using just a computation expression and a few helper functions. (The library has many more helper functions and computation expressions as well as infix operators; see the rest of the documentation for details.)
Sponsor(s):
Last updated