> 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/result/operators.md).

# Operators

Namespace: `FsToolkit.ErrorHandling.Operator.Result`

FsToolkit.ErrorHandling provides the standard infix operators for the `map` (`<!>`), `apply` (`<*>`), and `bind` (`>>=`) functions of the `Result` type.

## Examples

### Example 1

The example that we saw in the [Result.map3](/fstoolkit-errorhandling/fstoolkit.errorhandling/result/map3.md#example-1) can be solved using the `map` and `apply` operators as below:

```fsharp
open FsToolkit.ErrorHandling.Operator.Result

let opResult =
  add
  <!> tryParseInt "35"
  <*> tryParseInt "5"
  <*> tryParseInt "2"
```

Let's assume that we want to implement a function, `tryParseEvenInt`, which parses a string to an integer only if the string represents an even integer. We can implement it using the `bind` operator as below:

```fsharp
// int -> Result<int, string>
let evenInt x =
  if x % 2 = 0 then
    Ok x 
  else
    Error (sprintf "%d is not a even integer" x)

// string -> Result<int,string>
let tryParseEvenInt str =
  tryParseInt str
  >>= evenInt

tryParseEvenInt "42" // Ok 42
tryParseEvenInt "41" // Error "41 is not a even integer"
tryParseEvenItn "foo" // Error "Unable to parse 'foo' to integer"
```

Note that `>>=` is just a shortcut for `|> Result.bind`:

```fsharp
let tryParseEvenInt str =
  tryParseInt str
  |> Result.bind evenInt
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/result/operators.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
