Eq

scalus.cardano.onchain.plutus.prelude.Eq
See theEq companion trait
object Eq

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Eq.type

Members list

Value members

Concrete methods

inline def apply[A : Eq]: Eq[A]
def by[A, B : Eq](mapper: A => B): Eq[A]

Compare-by-key equality. Non-structural, so not available in on-chain code: on-chain equality is always structural (see Eq).

Compare-by-key equality. Non-structural, so not available in on-chain code: on-chain equality is always structural (see Eq).

Attributes

inline def derived[A]: Eq[A]

Derives an Eq instance for type A (case class, enum, or sealed trait)

Derives an Eq instance for type A (case class, enum, or sealed trait)

Attributes

def structural[A](f: (A, A) => Boolean): Eq[A]

Asserts that f implements structural equality for A and wraps it as an Eq[A].

Asserts that f implements structural equality for A and wraps it as an Eq[A].

This is the only way (besides derived) to introduce an Eq instance usable in on-chain code: the compiler plugin rejects bare lambdas because on-chain === and Eq-based operations are always lowered to structural comparison of the runtime representation — a non-structural f would be silently ignored there. By wrapping f you assert that f(a, b) iff a and b are structurally equal (a.toData == b.toData); the compiler is free to replace it with an equivalent representation-optimal comparison.

Attributes

Concrete fields

lazy val sirDeps: List[SIRModuleWithDeps]
lazy val sirModule: Module

Givens

Givens

given given_Eq_A_B[A : Eq, B : Eq]: Eq[(A, B)]
given given_Eq_A_B_C[A : Eq, B : Eq, C : Eq]: Eq[(A, B, C)]
given given_Eq_BigInt: Eq[BigInt]
given given_Eq_Boolean: Eq[Boolean]
given given_Eq_String: Eq[String]
given given_Eq_Unit: Eq[Unit]

Extensions

Extensions

extension [A](self: Eq[A])
inline def eqv(inline lhs: A, inline rhs: A): Boolean
inline def notEqv(inline lhs: A, inline rhs: A): Boolean
def orElse(other: Eq[A]): Eq[A]

Conjunction of two Eq instances. Produces a potentially non-structural instance, so not available in on-chain code: on-chain equality is always structural (see Eq).

Conjunction of two Eq instances. Produces a potentially non-structural instance, so not available in on-chain code: on-chain equality is always structural (see Eq).

Attributes

def orElseBy[B : Eq](mapper: A => B): Eq[A]

Refine equality by a projection. Produces a potentially non-structural instance, so not available in on-chain code: on-chain equality is always structural (see Eq).

Refine equality by a projection. Produces a potentially non-structural instance, so not available in on-chain code: on-chain equality is always structural (see Eq).

Attributes