Eq

scalus.cardano.onchain.plutus.prelude.Eq
See theEq companion object
@FunctionalInterface
trait Eq[-A] extends (A, A) => Boolean, CompileDerivations

Structural equality typeclass.

On-chain, Eq is a marker: the compiler always lowers === and Eq-based operations (List.contains, List.distinct, Option.contains, ...) to structural equality of the arguments' runtime representation — the instance body is never called. For that to be sound, every Eq instance must implement structural equality (eq(a, b) iff a.toData == b.toData). The compiler plugin therefore rejects hand-written instances in on-chain code: use Eq.derived, or Eq.structural to assert that a function is structural equality.

Attributes

Companion
object
Graph
Supertypes
trait (A, A) => Boolean
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

override def apply(lhs: A, rhs: A): Boolean

Attributes

Definition Classes
Function2

Concrete methods

inline def eqv(inline lhs: A, inline rhs: A): Boolean
Extension method from Eq
inline def notEqv(inline lhs: A, inline rhs: A): Boolean
Extension method from Eq
def orElse(other: Eq[A]): Eq[A]
Extension method from 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).

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]
Extension method from 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).

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

Inherited methods

def curried: A => A => Boolean

Attributes

Inherited from:
Function2
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function2 -> Any
Inherited from:
Function2
def tupled: ((A, A)) => Boolean

Attributes

Inherited from:
Function2