# Computation Expression

### CancellableTaskValidation Computation Expression

Namespace: `FsToolkit.ErrorHandling`

The `CancellableTaskValidation` type is defined as:

```fsharp
type CancellableTaskValidation<'a,'err> = CancellableTask<Result<'a, 'err list>>
```

This CE can take advantage of the [and! operator](https://github.com/fsharp/fslang-suggestions/issues/579) to join multiple error results into a list.

### Examples

See [here](/fstoolkit-errorhandling/fstoolkit.errorhandling/index/ce.md) for other validation-like examples

```fsharp
// Result<string, string> -> CancellableTask<Result<string, string>>
let downloadCancellableTask stuff = cancellableTask {
    return stuff
}

// CancellableTaskValidation<string, string>
let result = cancellableTaskValidation {
  let! x = downloadCancellableTask (Ok "I")
  and! y = downloadCancellableTask (Ok "am")
  and! z = downloadCancellableTask (Ok "cancellableTask!")
  return sprintf "%s %s %s" x y z
}
// cancellableTask { return Ok "I am cancellableTask!" }

// CancellableTaskValidation<string, string>
let result = cancellableTaskValidation {
  let! x = downloadCancellableTask (Error "Am")
  and! y = downloadCancellableTask (Error "I")
  and! z = downloadCancellableTask (Error "cancellableTask?")
  return sprintf "%s %s %s" x y z
}

// cancellableTask { return Error [ "Am"; "I"; "cancellableTask?" ] }
```


---

# 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.icedtasks/index-1/ce.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.
