> For the complete documentation index, see [llms.txt](https://demystifyfp.gitbook.io/fstoolkit-errorhandling/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/taskresultoption/bind.md).

# bind

### TaskResultOption.bind

Namespace: `FsToolkit.ErrorHandling`

Function Signature:

```fsharp
('a -> Task<Result<'b option, 'c>>)
  -> Task<Result<'a option, 'c>>
  -> Task<Result<'b option, 'c>>
```

### Examples

Note: Many use-cases requiring `bind` can also be solved using [the `taskResultOption` computation expression](/fstoolkit-errorhandling/fstoolkit.errorhandling/taskresultoption/ce.md).

#### Example 1

Given the following functions:

```fsharp
getUserById : UserId -> Task<Result<User option, exn>>
getPostById : PostId -> Task<Result<Post option, exn>>
```

We can get a post's user given a `PostId` like this:

```fsharp
// Task<Result<Post option, exn>>
getPostById postId
|> TaskResultOption.bind (fun post -> getUserById post.UserId)
```
