Equality protocol for structural comparison of values.

The Eq(T) protocol mirrors the built-in == operator but can be implemented for user-defined types so generic algorithms stay polymorphic. ne/2 is derived from eq/2.

Examples

use Std.Eq

eq(1, 1)                                # => true
ne("a", "b")                            # => true
eq(:ok, :ok)                            # => true

Protocols

  • proto Eq(T)

    Equality between two T values.

Functions

  • # fn __group__() -> Atom

    Group tag consumed by Cure.Stdlib.Preload.

  • # fn eq(a: Int, b: Int) -> Bool

    Primitive integer equality.

  • # fn eq(a: Float, b: Float) -> Bool

    Primitive float equality.

  • # fn eq(a: String, b: String) -> Bool

    Primitive string equality.

  • # fn eq(a: Bool, b: Bool) -> Bool

    Primitive boolean equality.

  • # fn eq(a: Atom, b: Atom) -> Bool

    Primitive atom equality.

  • # fn ne(a: T, b: T) -> Bool

    Inequality derived from eq/2.