> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canton.network/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If you are building a Canton Network application, start from https://docs.canton.network/appdev/quickstart.md. To run only a local network for your own Daml code, without building the QuickStart demo, see https://docs.canton.network/sdks-tools/development-tools/localnet.md.

# DA.Either

> Reference documentation for Daml module DA.Either.

Daml module

# DA.Either

The Either type represents values with two possibilities.

Daml

Module
DA.Either

Latest release
3.7.5

## Functions

### `lefts`

`lefts` : \[[`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b`] -> \[`a`]

Extracts all the `Left` elements from a list.

### `rights`

`rights` : \[[`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b`] -> \[`b`]

Extracts all the `Right` elements from a list.

### `partitionEithers`

`partitionEithers` : \[[`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b`] -> (\[`a`], \[`b`])

Partitions a list of `Either` into two lists, the `Left` and
`Right` elements respectively. Order is maintained.

### `isLeft`

`isLeft` : [`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b` -> [`Bool`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-bool-66265)

Return `True` if the given value is a `Left`-value, `False`
otherwise.

### `isRight`

`isRight` : [`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b` -> [`Bool`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-bool-66265)

Return `True` if the given value is a `Right`-value, `False`
otherwise.

### `fromLeft`

`fromLeft` : `a` -> [`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b` -> `a`

Return the contents of a `Left`-value, or a default value
in case of a `Right`-value.

### `fromRight`

`fromRight` : `b` -> [`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b` -> `b`

Return the contents of a `Right`-value, or a default value
in case of a `Left`-value.

### `optionalToEither`

`optionalToEither` : `a` -> [`Optional`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-prelude-optional-37153) `b` -> [`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b`

Convert a `Optional` value to an `Either` value, using the supplied
parameter as the `Left` value if the `Optional` is `None`.

### `eitherToOptional`

`eitherToOptional` : [`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b` -> [`Optional`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-prelude-optional-37153) `b`

Convert an `Either` value to a `Optional`, dropping any value in
`Left`.

### `maybeToEither`

`maybeToEither` : `a` -> [`Optional`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-prelude-optional-37153) `b` -> [`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b`

> [!WARNING]
>
> Deprecated: Daml 1.2 compatibility helper, use 'optionalToEither' instead of 'maybeToEither'

### `eitherToMaybe`

`eitherToMaybe` : [`Either`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-types-either-56020) `a` `b` -> [`Optional`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-prelude-optional-37153) `b`

> [!WARNING]
>
> Deprecated: Daml 1.2 compatibility helper, use 'eitherToOptional' instead of 'eitherToMaybe'
