> ## Documentation Index
> Fetch the complete documentation index at: https://cantonfoundation-dpm-import.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# DA.Action

> Reference documentation for Daml module DA.Action.

<span id="module-da-action-7169" />

# DA.Action

Action

## Module Snapshot

<CardGroup cols={2}>
  <Card title="Lifecycle">
    Stable.
  </Card>

  <Card title="Notices">
    Status: `active`
    Introduced in: `3.4.9`
    Removed in: `-`
    Warnings: `0`
    Deprecations: `0`
    Deprecated since: `-`
  </Card>
</CardGroup>

## Functions

<span id="function-da-action-when-35467" />

### `when`

`when` : [`Applicative`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-applicative-9257) `f` => [`Bool`](/appdev/reference/daml-standard-library/prelude#type-ghc-types-bool-66265) -> `f` () -> `f` ()

Conditional execution of `Action` expressions. For example,

```
  when final (archive contractId)
```

will archive the contract `contractId` if the Boolean value `final` is
`True`, and otherwise do nothing.

This function has short-circuiting semantics, i.e., when both arguments are
present and the first arguments evaluates to `False`, the second argument
is not evaluated at all.

<span id="function-da-action-unless-8539" />

### `unless`

`unless` : [`Applicative`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-applicative-9257) `f` => [`Bool`](/appdev/reference/daml-standard-library/prelude#type-ghc-types-bool-66265) -> `f` () -> `f` ()

The reverse of `when`.

This function has short-circuiting semantics, i.e., when both arguments are
present and the first arguments evaluates to `True`, the second argument
is not evaluated at all.

<span id="function-da-action-foldra-2803" />

### `foldrA`

`foldrA` : [`Action`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-action-68790) `m` => (`a` -> `b` -> `m` `b`) -> `b` -> \[`a`] -> `m` `b`

The `foldrA` is analogous to `foldr`, except that its result is
encapsulated in an action. Note that `foldrA` works from right-to-left
over the list arguments.

<span id="function-da-action-foldr1a-55935" />

### `foldr1A`

`foldr1A` : [`Action`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-action-68790) `m` => (`a` -> `a` -> `m` `a`) -> \[`a`] -> `m` `a`

`foldr1A` is like `foldrA` but raises an error when presented
with an empty list argument.

<span id="function-da-action-foldla-78897" />

### `foldlA`

`foldlA` : [`Action`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-action-68790) `m` => (`b` -> `a` -> `m` `b`) -> `b` -> \[`a`] -> `m` `b`

`foldlA` is analogous to `foldl`, except that its result is
encapsulated in an action. Note that `foldlA` works from
left-to-right over the list arguments.

<span id="function-da-action-foldl1a-65193" />

### `foldl1A`

`foldl1A` : [`Action`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-action-68790) `m` => (`a` -> `a` -> `m` `a`) -> \[`a`] -> `m` `a`

The `foldl1A` is like `foldlA` but raises an errors when
presented with an empty list argument.

<span id="function-da-action-filtera-13011" />

### `filterA`

`filterA` : [`Applicative`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-applicative-9257) `m` => (`a` -> `m` [`Bool`](/appdev/reference/daml-standard-library/prelude#type-ghc-types-bool-66265)) -> \[`a`] -> `m` \[`a`]

Filters the list using the applicative function: keeps only the elements where the predicate holds.
Example: given a collection of Iou contract IDs one can find only the GBPs.

```
filterA (fmap (\iou -> iou.currency == "GBP") . fetch) iouCids
```

<span id="function-da-action-replicatea-98867" />

### `replicateA`

`replicateA` : [`Applicative`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-applicative-9257) `m` => [`Int`](/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261) -> `m` `a` -> `m` \[`a`]

`replicateA n act` performs the action `n` times, gathering the
results.

<span id="function-da-action-replicatea-83733" />

### `replicateA_`

`replicateA_` : [`Applicative`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-applicative-9257) `m` => [`Int`](/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261) -> `m` `a` -> `m` ()

Like `replicateA`, but discards the result.

<span id="function-da-action-gteqgt-60955" />

### `>=>`

`>=>` : [`Action`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-action-68790) `m` => (`a` -> `m` `b`) -> (`b` -> `m` `c`) -> `a` -> `m` `c`

Left-to-right composition of Kleisli arrows.

<span id="function-da-action-lteqlt-31871" />

### `<=<`

`<=<` : [`Action`](/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-action-68790) `m` => (`b` -> `m` `c`) -> (`a` -> `m` `b`) -> `a` -> `m` `c`

Right-to-left composition of Kleisli arrows. @('>=>')@, with the arguments
flipped.
