(self: bigint, that: bigint): booleanEquivalence instance for bigints using strict equality (===).
When to use
Use when you need to supply bigint equality.
Example (Comparing bigints)
import { Equivalence } from "effect"
console.log(Equivalence.BigInt(1n, 1n)) // true
console.log(Equivalence.BigInt(1n, 2n)) // falseinstances
Source effect/Equivalence.ts:2861 lines
export const const BigInt: Equivalence<bigint>Equivalence instance for bigints using strict equality (===).
When to use
Use when you need to supply bigint equality.
Example (Comparing bigints)
import { Equivalence } from "effect"
console.log(Equivalence.BigInt(1n, 1n)) // true
console.log(Equivalence.BigInt(1n, 2n)) // false
BigInt: type Equivalence<in A> = (
self: A,
that: A
) => boolean
Represents an equivalence relation over type A.
When to use
Use as a type annotation when you accept or return an equivalence function.
Details
- Returns
boolean: true if values are equivalent, false otherwise
- Must satisfy reflexive, symmetric, and transitive properties
Example (Defining simple number equivalence)
import type { Equivalence } from "effect"
const numberEq: Equivalence.Equivalence<number> = (a, b) => a === b
console.log(numberEq(1, 1)) // true
console.log(numberEq(1, 2)) // false
Example (Defining custom object equivalence)
import type { Equivalence } from "effect"
interface Point {
x: number
y: number
}
const pointEq: Equivalence.Equivalence<Point> = (a, b) =>
a.x === b.x && a.y === b.y
console.log(pointEq({ x: 1, y: 2 }, { x: 1, y: 2 })) // true
Equivalence<bigint> = const isStrictEquivalent: (
x: unknown,
y: unknown
) => boolean
isStrictEquivalentReferenced by 1 symbols