---
title: "U2026: An operation on a type parameter that its constraint does not allow"
url: https://una-lang.org/en/docs/errors/U2026/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U2026.md
---

# U2026: An operation on a type parameter that its constraint does not allow

On values of a type parameter, `==` and `!=` need the constraint `Eq`, the orderings `<`, `<=`, `>` and `>=` need `Ord`, and `x.to_int()` needs `Integer` (`spec/20 §3`). A public function writes the constraint on the parameter, as `[T: Ord]`; a private one gets it inferred when none is written. Arithmetic is never defined on a type parameter: convert with `to_int()` under `Integer` (`spec/20 §1` rule 6).

## The repair at a glance

`src/demo.una`

```diff
  module demo

- pub same[T](a: T, b: T) -> Bool = a == b
+ pub same[T: Eq](a: T, b: T) -> Bool = a == b
```

## Failing example

`una.toml`

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

`src/demo.una`

```una
module demo

pub same[T](a: T, b: T) -> Bool = a == b
```

## Fixed example

`una.toml`

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

`src/demo.una`

```una
module demo

pub same[T: Eq](a: T, b: T) -> Bool = a == b
```
