---
title: "U2010: Cannot infer lambda parameter type"
url: https://una-lang.org/en/docs/errors/U2010/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U2010.md
---

# U2010: Cannot infer lambda parameter type

A lambda takes the types of its parameters from the function type expected where it appears, such as the parameter `each` of `map` (`spec/03 §7`). Where no function type is expected, as on the right of a `let`, each parameter needs an annotation.

## The repair at a glance

```diff
  module demo

  pub two() -> Int
  =
-   let add_one = fn(x) -> x + 1
+   let add_one = fn(x: Int) -> x + 1
    add_one(1)
```

## Failing example

```una
module demo

pub two() -> Int
=
  let add_one = fn(x) -> x + 1
  add_one(1)
```

## Fixed example

```una
module demo

pub two() -> Int
=
  let add_one = fn(x: Int) -> x + 1
  add_one(1)
```
