| 1 |
// from https://fsharpforfunandprofit.com/posts/elevated-world-5/ |
| 2 |
module AsyncResult |
| 3 |
|
| 4 |
type AsyncResult<'a, 'e> = Async<Result<'a, 'e>> |
| 5 |
|
| 6 |
let bind f xAsyncResult = async { |
| 7 |
let! xResult = xAsyncResult |
| 8 |
match xResult with |
| 9 |
| Ok x -> return! f x |
| 10 |
| Error err -> return (Error err) |
| 11 |
} |