Skip to content
Playground(another site)

bynk.types.held_not_comparable

Error A held value (Connection[F]) is compared with ==/!= — held values have identity, not value-equality (§2.9.3, real-time track slice 2).

A held Connection is a live resource with an identity: two values are the same connection or they are not, so there is no value to compare. So == on one, or on a type that holds one, is refused. Compare an id that you keep next to the connection. A Stream has bynk.types.stream_not_comparable, and functions and effects have bynk.types.not_comparable.

Example

type Frame = { text: String }
fn same(a: Connection[Frame], b: Connection[Frame]) -> Bool {
a == b // ✗ a connection has identity, not value
}
fn same(a: String, b: String) -> Bool { // ✓ compare ids kept beside them
a == b
}

In the Book

See also

  • Every code in its category, Type checking, on the diagnostic index.
  • bynk explain bynk.types.held_not_comparable shows the same from the installed toolchain, without a network.