# V2032 constraint_not_satisfied

URL: /docs/errors/V2032
Markdown: /docs/errors/V2032.md

> A type does not satisfy a constraint the operation requires: Eq, Ord, Hash or Schema (Show is V2031).

An error from the `type` phase. `sakura explain V2032` prints this explanation offline.

A type does not satisfy a constraint the operation requires: `Eq`, `Ord`, `Hash` or `Schema`
(`Show` is `V2031`). Functions, handlers, resources and secrets have none of them (design §4.4).

Wrong:

```sakura
let same = handler_a == handler_b
```

Fixed:

```sakura
compare the data the handlers were built from instead
```

## Wrong program [#wrong-program]

[`compiler/tests/ui/V2032_constraint_not_satisfied.sakura`](https://github.com/icantcodefyi/sakuralang/blob/master/compiler/tests/ui/V2032_constraint_not_satisfied.sakura), which the compiler's ui suite runs through `sakura check`:

```sakura
fn same() -> Bool {
  let f = fn() { 1 }
  f == f
}
```

`sakura check --json` reports this record (pretty-printed; `$DIR` is the fixture's directory):

```json
{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:2da2d755ba794ebb",
  "code": "V2032",
  "severity": "error",
  "phase": "type",
  "message": "`fn() -> Int` does not satisfy `Eq` (design §4.4)",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": "main::V2032_constraint_not_satisfied::same",
  "spans": [
    {
      "uri": "file://$DIR/V2032_constraint_not_satisfied.sakura",
      "content_hash": "sha256:ae6e16cc8193b90d276e40d7b7778b00256657d9160b737dfa95ce724166d94f",
      "start_byte": 77,
      "end_byte": 83,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": {
    "render": "Eq"
  },
  "actual": {
    "render": "fn() -> Int"
  },
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V2032",
  "fixes": []
}
```

## Fixed program [#fixed-program]

[`compiler/tests/ui/V2032_constraint_not_satisfied.fixed.sakura`](https://github.com/icantcodefyi/sakuralang/blob/master/compiler/tests/ui/V2032_constraint_not_satisfied.fixed.sakura), which `sakura check` accepts with no diagnostics:

```sakura
fn same() -> Bool {
  let f = fn() { 1 }
  f() == f()
}
```
