All instances of Eq must satisfy the following conditions:

  • Symmetric: Eq<A, B> always equals to Eq<B, A>.
  • Transitive: Eq<A, B> and Eq<B, C> always implies Eq<A, C>.
  • Reflexive: Passing two same values to Eq<A, A> always returns true.

For example, the comparator below cannot implement Eq because that does not satisfy reflexive due to NaN === NaN always be false.

import { PartialEq } from "./partial-eq.ts";

const numPartialEq: PartialEq<number, number> = {
eq: (x, y) => x === y,
};

Type Parameters

  • T

Hierarchy

Properties

Properties

[eqSymbol]: true
eq: ((l, r) => boolean)

Type declaration

    • (l, r): boolean
    • Parameters

      • l: T
      • r: T

      Returns boolean

hash: ((self) => ((hasher) => Readonly<{
    state: (() => bigint);
    write: ((bytes) => Readonly<({ state: () => bigint; write: (bytes: ArrayBuffer) => Readonly<...>; })>);
}>))

Type declaration

    • (self): ((hasher) => Readonly<{
          state: (() => bigint);
          write: ((bytes) => Readonly<({ state: () => bigint; write: (bytes: ArrayBuffer) => Readonly<...>; })>);
      }>)
    • Parameters

      • self: T

      Returns ((hasher) => Readonly<{
          state: (() => bigint);
          write: ((bytes) => Readonly<({ state: () => bigint; write: (bytes: ArrayBuffer) => Readonly<...>; })>);
      }>)

        • (hasher): Readonly<{
              state: (() => bigint);
              write: ((bytes) => Readonly<({ state: () => bigint; write: (bytes: ArrayBuffer) => Readonly<...>; })>);
          }>
        • Parameters

          • hasher: Readonly<{
                state: (() => bigint);
                write: ((bytes) => Readonly<({ state: () => bigint; write: (bytes: ArrayBuffer) => Readonly<...>; })>);
            }>

          Returns Readonly<{
              state: (() => bigint);
              write: ((bytes) => Readonly<({ state: () => bigint; write: (bytes: ArrayBuffer) => Readonly<...>; })>);
          }>

Generated using TypeDoc