PairList

scalus.cardano.onchain.plutus.prelude.PairList
See thePairList companion enum
object PairList

Attributes

Companion
enum
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
PairList.type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

inline def empty[A, B]: PairList[A, B]
def from[A, B](it: IterableOnce[(A, B)]): PairList[A, B]
inline def single[A, B](a: A, b: B): PairList[A, B]

Concrete fields

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

Extensions

Extensions

extension [A, B](self: PairList[A, B])
def ++(other: PairList[A, B]): PairList[A, B]
def asScala: List[(A, B)]
def exists(p: ((A, B)) => Boolean): Boolean
def filter(p: ((A, B)) => Boolean): PairList[A, B]
def filterNot(p: ((A, B)) => Boolean): PairList[A, B]
def find(p: ((A, B)) => Boolean): Option[(A, B)]
def findMap[C](f: ((A, B)) => Option[C]): Option[C]
def foldLeft[C](init: C)(f: (C, (A, B)) => C): C
def foldRight[C](init: C)(f: ((A, B), C) => C): C
def forall(p: ((A, B)) => Boolean): Boolean
def head: (A, B)

Returns the first element of this PairList.

Returns the first element of this PairList.

Attributes

Returns

The first key-value pair.

Throws
NoSuchElementException

If the PairList is empty.

Example
 PairList.single("a", 1).head === ("a", 1)
def isEmpty: Boolean
def length: BigInt
def map[C, D](f: ((A, B)) => (C, D)): PairList[C, D]
def mapValues[C](f: B => C): PairList[A, C]

Maps values while keeping keys unchanged.

Maps values while keeping keys unchanged.

On-chain this is significantly cheaper than List.map on tuples because it uses fstPair/sndPair builtins directly (~4 ops/element vs ~12).

Attributes

def nonEmpty: Boolean
def prepended(elem: (A, B)): PairList[A, B]
def toList: List[(A, B)]

Converts this PairList to a List[(A, B)].

Converts this PairList to a List[(A, B)].

On-chain this is a zero-cost operation (noop in UPLC) because both types share the same SumDataPairList representation.

Attributes

extension [A, B](self: List[(A, B)])
def toPairList: PairList[A, B]

Converts a List[(A, B)] to a PairList[A, B].

Converts a List[(A, B)] to a PairList[A, B].

On-chain this is a zero-cost operation (noop in UPLC) because both types share the same SumDataPairList representation.

Attributes