Skip to main content

std (top level)

Pebble 0.3.1 · all symbols on this page are stable.

A handful of polymorphic helpers live directly on the std namespace itself, alongside the sub-namespaces (std.crypto, std.list, etc.).

Methods

FunctionDescription
id<T>(x: T): TThe polymorphic identity. Useful as a default callback or "do-nothing" higher-order argument.
equals<T>(a: T, b: T): boolCompile-time-dispatched equality. The compiler picks equalsInteger, equalsByteString, equalsData, etc. based on the instantiation of T. For data-encoded structs and most non-primitive types, falls back to equalsData (structural CBOR equality).
Polymorphic equality vs ==

equals<T> exists for higher-order use (xs.some((x) => equals(x, target))). In direct code, the == operator already dispatches the same way and is more readable.

See also