# singleton

### CancellableTaskValidation.singleton

Namespace: `FsToolkit.ErrorHandling`

Lifts a value into a `CancellableTaskValidation`, wrapping it as an `Ok` result. This is the primary way to create a successful `CancellableTaskValidation` value.

### Function Signature:

```fsharp
'item -> CancellableTaskValidation<'item, 'Error>
```

### Examples

#### Example 1

```fsharp
let result : CancellableTaskValidation<int, string> =
  CancellableTaskValidation.singleton 42
```

#### Example 2

Using `singleton` inside a pipeline to return a validated value:

```fsharp
let validateAge (age: int) : CancellableTaskValidation<int, string> =
  if age >= 0 then CancellableTaskValidation.singleton age
  else CancellableTaskValidation.error "Age must be non-negative"
```


---

# 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/singleton.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.
