tur/typeclass-eq
minimal Eq typeclass stub for typed-collection definstances.
Auto-loaded so vec, list, set, map, option, result, and pair can declare (definstance Eq [...] ...) without importing typeclass.tur.
Since: Phase PTC4
Eq
(defclass Eq [a])
values that can be compared for equality.
| a | the type compared |
(eq? [x y] :bool)-
true when
xandyare equal. Collections compare element-wise through their element type's own Eq instance.
(eq? x x) = true (eq? x y) = (eq? y x) (eq? x y) and (eq? y z) imply (eq? x z)
(eq? 3 3) ; => true (eq? "a" "b") ; => false
Superclass of Ord, and the partner of Hash: two values that are eq? must hash alike.
Char, Complex, Datum, Cons, Map, MutableMap, Option, Pair, Bound, Rational, Result, Set, str, StringSlice, String, Sym, Tuple2, int, bool, cstr, float, int8, int16, int32, uint8, uint16, uint32, uint64, float32, Sum, Product, MinI, MaxI, Any, All, Vec
Since: Phase 15
Eq[int]
(definstance Eq [int])
equality on int64_t.
Eq[bool]
(definstance Eq [bool])
equality on bool.
Eq[cstr]
(definstance Eq [cstr])
equality on cstr (null-terminated string). Uses the runtime's string comparator rather than pointer equality.
Eq[float]
(definstance Eq [float])
equality on double.
Eq[int8]
(definstance Eq [int8])
Eq instances for the remaining numeric primitives so typed-collection dispatch through (.eq? v v) on Vec[int8], Vec[uint32], etc. satisfies the (Eq A) constraint without requiring users to import stdlib/typeclass.tur.
Eq[int16]
(definstance Eq [int16])
Eq[int32]
(definstance Eq [int32])
Eq[uint8]
(definstance Eq [uint8])
Eq[uint16]
(definstance Eq [uint16])
Eq[uint32]
(definstance Eq [uint32])
Eq[uint64]
(definstance Eq [uint64])
Eq[float32]
(definstance Eq [float32])