---
title: "U3019: `of` clause that names a function type with its own `uses` or `fails`"
url: https://una-lang.org/en/docs/errors/U3019/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U3019.md
---

# U3019: `of` clause that names a function type with its own `uses` or `fails`

An `of` clause leaves the effects and failures of a parameter open: each call gives them by its argument (ADR 0062). A parameter whose type writes its own `uses` or `fails`, as in `fn(Int) -> Unit uses @log: Log[write]`, fixes them already, so `uses of` or `fails of` on it is U3019. Remove the clauses from the parameter's type to make it open, or remove the `of` clause to keep the fixed effects.

## The repair at a glance

`src/demo.una`

```diff
  module demo

  pub capability Log
    op write(line: Text) -> Unit

- pub apply_all(xs: List[Int], each: fn(Int) -> Unit uses @log: Log[write]) -> Unit
-   uses @log: Log[write]
+ pub apply_all(xs: List[Int], each: fn(Int) -> Unit) -> Unit
    uses of each
  =
    for x in xs
      each(x)
```

## Failing example

`una.toml`

```toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.2"
```

`src/demo.una`

```una
module demo

pub capability Log
  op write(line: Text) -> Unit

pub apply_all(xs: List[Int], each: fn(Int) -> Unit uses @log: Log[write]) -> Unit
  uses @log: Log[write]
  uses of each
=
  for x in xs
    each(x)
```

## Fixed example

`una.toml`

```toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.2"
```

`src/demo.una`

```una
module demo

pub capability Log
  op write(line: Text) -> Unit

pub apply_all(xs: List[Int], each: fn(Int) -> Unit) -> Unit
  uses of each
=
  for x in xs
    each(x)
```
