# sequenceTaskResult

### Option.sequenceTaskResult

Namespace: `FsToolkit.ErrorHandling`

Function Signature:

```fsharp
Task<Result<'a, 'e>> option -> Task<Result<'a option>, 'e>
```

Note that `sequence` is the same as `traverse id`. See also [Option.traverseTaskResult](https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/traversetaskresult).

See also Scott Wlaschin's [Understanding traverse and sequence](https://fsharpforfunandprofit.com/posts/elevated-world-4/).

### Examples

#### Example 1

```fsharp
let r1 : Task<Result<int option, string>> =
  Some (task { return Ok 42 }) |> Option.sequenceTaskResult 
// task { return Ok (Some 42) }

let r2 : Task<Result<int option, string>> =
  Some (task { return Error "something went wrong" }) |> Option.sequenceTaskResult 
// task { return Error "something went wrong" }

let r3 : Task<Result<int option, string>> =
  None |> Option.sequenceTaskResult 
// task { return Ok None }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/sequencetaskresult.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
