Skip to content

Tuple2ValidatedNelOps<E, T1, T2>

extension Tuple2ValidatedNelOps<E, T1, T2> on Record

Provides additional functions on tuple with 2 ValidatedNels.

Properties

tupled extension no setter

ValidatedNel<NonEmptyIList<E>, Record> get tupled

If all items of this tuple are a Valid, the respective items are turned into a tuple and returned as a ValidatedNel. If any item is an Invalid, the accumulation of all Invalid instances is returned.

Available on Record, provided by the Tuple2ValidatedNelOps<E, T1, T2> extension

Implementation
dart
ValidatedNel<E, (T1, T2)> get tupled => $1.product($2);

Methods

mapN() extension

ValidatedNel<NonEmptyIList<E>, T3> mapN<T3>(T3 Function(T1, T2) fn)

Applies fn to the values of each respective tuple member if all values are a Valid. If any item is an Invalid, the accumulation of all Invalid instances is returned.

Available on Record, provided by the Tuple2ValidatedNelOps<E, T1, T2> extension

Implementation
dart
ValidatedNel<E, T3> mapN<T3>(Function2<T1, T2, T3> fn) => tupled.map(fn.tupled);