---
title: "U3013: Effectful or fallible call nested inside an expression"
url: https://una-lang.org/en/docs/errors/U3013/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U3013.md
---

# U3013: Effectful or fallible call nested inside an expression

A capability operation, or a call of a function that uses capabilities or can fail, is nested inside another expression or an argument.

## Why Una rejects it

One effect per line: a capability operation, or a call of a function that uses capabilities or can fail, is the whole expression of a statement, a `let` right-hand side or a final expression, optionally wrapped in `attempt` (`spec/04 §4`). It cannot be nested inside another expression or an argument.

This fixes the order of evaluation, gives every failure a handling site and makes every effect visible on its own line.

Example `do` lines are exempt (`spec/08 §2` rule 5).

## How to fix it

Bind the result with `let` first.

## The repair at a glance

```diff
  module demo

  capability Clock
    op now() -> Int

  pub later() -> Int
    uses @clock: Clock[now]
  =
-   1 + @clock.now()
+   let now = @clock.now()
+   1 + now
```

## Failing example

```una
module demo

capability Clock
  op now() -> Int

pub later() -> Int
  uses @clock: Clock[now]
=
  1 + @clock.now()
```

## Fixed example

```una
module demo

capability Clock
  op now() -> Int

pub later() -> Int
  uses @clock: Clock[now]
=
  let now = @clock.now()
  1 + now
```
