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
| Function | Description |
|---|---|
id<T>(x: T): T | The polymorphic identity. Useful as a default callback or "do-nothing" higher-order argument. |
equals<T>(a: T, b: T): bool | Compile-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.