Skip to content
Playground(another site)

bynk.types.not_comparable

Error A value compared with ==/!= contains a function, Effect, or Query somewhere inside it — those have no value equality, so the type is not equality-supporting (type-system §2.3.5, #1652).

== and != compare values structurally, which needs a value to compare. A function, an Effect and a Query are computations, and two of them have no equality. A type that holds one anywhere inside it, in a field, a payload, an element or a generic argument, is refused too. Compare what the computation produces, or the data it was built from. A Stream and a held connection have their own codes, bynk.types.stream_not_comparable and bynk.types.held_not_comparable.

Example

fn same(f: Int -> Int, g: Int -> Int) -> Bool {
f == g // ✗ functions have no equality
}
fn same(f: Int -> Int, g: Int -> Int) -> Bool {
f(1) == g(1) // ✓ compare what they produce
}

In the Book

See also

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