structuralEquals (Function)
Signature: structuralEquals(a: t0, b: t0) -> bool
Description: Compares two values by their contents, walking both completely, so its cost grows with their size; == deliberately does not do this. Both operands must be one type whose every part has a decided equality — a function, a runtime handle, any or Result anywhere inside is a compile error. NaN stays unequal to itself, including inside a record, list, map or union.
Parameters
- a (t0): The first value
- b (t0): The second value, of the same type
Returns: bool
Example
type Route = { tab: string, depth: int }
let same = structuralEquals(Route { tab: "home", depth: 1 }, Route { tab: "home", depth: 1 }) // true
let differ = structuralEquals([1, 2], [1, 2, 3]) // false
type Route =
tab : string
depth : int
let same = structuralEquals(Route
tab = "home"
depth = 1, Route
tab = "home"
depth = 1) // true
let differ = structuralEquals([1, 2], [1, 2, 3]) // false