# bind

Namespace: `FsToolkit.ErrorHandling`

## Function Signature

```fsharp
('TInput -> 'TOutput option) -> 'TInput option -> 'TOutput option
```

## Examples

Take the following function for example

```fsharp
// string -> int option
let tryParseInt (s: string) =
    match Int32.TryParse(s) with
    | true, i -> Some i
    | false, _ -> None
```

### Example 1

```fsharp
let opt : int option =
    Some "123" // string option
    |> Option.bind tryParseInt // int option

// Some 123
```

### Example 2

```fsharp
let opt : int option =
    Some "Not a number" // string option
    |> Option.bind tryParseInt // int option

// None
```

### Example 3

```fsharp
let opt : int option =
    None // string option
    |> Option.bind tryParseInt // int option

// 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/bind.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.
