diff --git a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Builders.kt b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Builders.kt index de970877bfe..47d9a1788ed 100644 --- a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Builders.kt +++ b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Builders.kt @@ -7,7 +7,6 @@ package arrow.core.raise import arrow.atomic.Atomic import arrow.atomic.updateAndGet import arrow.core.Either -import arrow.core.EmptyValue.combine import arrow.core.Ior import arrow.core.NonEmptyList import arrow.core.NonEmptySet @@ -22,18 +21,69 @@ import kotlin.experimental.ExperimentalTypeInference import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName +/** + * Runs a computation [block] using [Raise], and return its outcome as [Either]. + * - [Either.Right] represents success, + * - [Either.Left] represents logical failure. + * + * This function re-throws any exceptions thrown within the [Raise] block. + * + * Read more about running a [Raise] computation in the + * [Arrow docs](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#running-and-inspecting-results). + */ public inline fun either(@BuilderInference block: Raise.() -> A): Either = fold({ block.invoke(this) }, { Either.Left(it) }, { Either.Right(it) }) +/** + * Runs a computation [block] using [Raise], and return its outcome as nullable type, + * where `null` represents logical failure. + * + * This function re-throws any exceptions thrown within the [Raise] block. + * + * Read more about running a [Raise] computation in the + * [Arrow docs](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#running-and-inspecting-results). + */ public inline fun nullable(block: NullableRaise.() -> A): A? = merge { block(NullableRaise(this)) } +/** + * Runs a computation [block] using [Raise], and return its outcome as [Result]. + * + * + * Read more about running a [Raise] computation in the + * [Arrow docs](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#running-and-inspecting-results). + */ public inline fun result(block: ResultRaise.() -> A): Result = fold({ block(ResultRaise(this)) }, Result.Companion::failure, Result.Companion::failure, Result.Companion::success) +/** + * Runs a computation [block] using [Raise], and return its outcome as [Option]. + * - [Some] represents success, + * - [None] represents logical failure. + * + * This function re-throws any exceptions thrown within the [Raise] block. + * + * Read more about running a [Raise] computation in the + * [Arrow docs](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#running-and-inspecting-results). + */ public inline fun option(block: OptionRaise.() -> A): Option = fold({ block(OptionRaise(this)) }, ::identity, ::Some) +/** + * Runs a computation [block] using [Raise], and return its outcome as [Ior]. + * - [Ior.Right] represents success, + * - [Ior.Left] represents logical failure which made it impossible to continue, + * - [Ior.Both] represents that some logical failures were raised, + * but it was possible to continue until producing a final value. + * + * This function re-throws any exceptions thrown within the [Raise] block. + * + * In both [Ior.Left] and [Ior.Both] cases, if more than one logical failure + * has been raised, they are combined using [combineError]. + * + * Read more about running a [Raise] computation in the + * [Arrow docs](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#running-and-inspecting-results). + */ public inline fun ior(noinline combineError: (Error, Error) -> Error, @BuilderInference block: IorRaise.() -> A): Ior { val state: Atomic> = Atomic(None) return fold>( @@ -46,6 +96,10 @@ public inline fun ior(noinline combineError: (Error, Error) -> Error, public typealias Null = Nothing? +/** + * Implementation of [Raise] used by [nullable]. + * You should never use this directly. + */ public class NullableRaise(private val raise: Raise) : Raise by raise { @RaiseDSL public fun ensure(value: Boolean): Unit = ensure(value) { null } @@ -84,6 +138,10 @@ public class NullableRaise(private val raise: Raise) : Raise by rais } } +/** + * Implementation of [Raise] used by [result]. + * You should never use this directly. + */ public class ResultRaise(private val raise: Raise) : Raise by raise { @RaiseDSL public fun Result.bind(): A = fold(::identity) { raise(it) } @@ -117,6 +175,10 @@ public class ResultRaise(private val raise: Raise) : Raise ) } +/** + * Implementation of [Raise] used by [option]. + * You should never use this directly. + */ public class OptionRaise(private val raise: Raise) : Raise by raise { @RaiseDSL public fun Option.bind(): A = getOrElse { raise(None) } @@ -159,6 +221,10 @@ public class OptionRaise(private val raise: Raise) : Raise by raise } } +/** + * Implementation of [Raise] used by [ior]. + * You should never use this directly. + */ public class IorRaise @PublishedApi internal constructor( @PublishedApi internal val combineError: (Error, Error) -> Error, private val state: Atomic>, diff --git a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Fold.kt b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Fold.kt index 1021ed3a8b7..a89b46b9ec5 100644 --- a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Fold.kt +++ b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Fold.kt @@ -37,6 +37,13 @@ public suspend fun Effect.fold( return fold({ invoke() }, { catch(it) }, { recover(it) }, { transform(it) }) } +/** + * `invoke` the [Effect] and [fold] the result: + * - _success_ [transform] result of [A] to a value of [B]. + * - _raised_ [recover] from `raised` value of [Error] to a value of [B]. + * + * This function re-throws any exceptions thrown within the [Effect]. + */ public suspend fun Effect.fold( recover: suspend (error: Error) -> B, transform: suspend (value: A) -> B, @@ -48,6 +55,15 @@ public suspend fun Effect.fold( return fold({ throw it }, recover, transform) } +/** + * `invoke` the [EagerEffect] and [fold] the result: + * - _success_ [transform] result of [A] to a value of [B]. + * - _raised_ [recover] from `raised` value of [Error] to a value of [B]. + * - _exception_ [catch] from [Throwable] by transforming value into [B]. + * + * This method should never be wrapped in `try`/`catch` as it will not throw any unexpected errors, + * it will only result in [CancellationException], or fatal exceptions such as `OutOfMemoryError`. + */ public inline fun EagerEffect.fold( catch: (throwable: Throwable) -> B, recover: (error: Error) -> B, @@ -61,6 +77,13 @@ public inline fun EagerEffect.fold( return fold({ invoke(this) }, catch, recover, transform) } +/** + * `invoke` the [EagerEffect] and [fold] the result: + * - _success_ [transform] result of [A] to a value of [B]. + * - _raised_ [recover] from `raised` value of [Error] to a value of [B]. + * + * This function re-throws any exceptions thrown within the [Effect]. + */ public inline fun EagerEffect.fold(recover: (error: Error) -> B, transform: (value: A) -> B): B { contract { callsInPlace(recover, AT_MOST_ONCE) @@ -69,6 +92,14 @@ public inline fun EagerEffect.fold(recover: (error: Erro return fold({ throw it }, recover, transform) } +/** + * The most general way to execute a computation using [Raise]. + * Depending on the outcome of the block, one of the two continuations is run: + * - _success_ [transform] result of [A] to a value of [B]. + * - _raised_ [recover] from `raised` value of [Error] to a value of [B]. + * + * This function re-throws any exceptions thrown within the [Raise] block. + */ @JvmName("_foldOrThrow") public inline fun fold( @BuilderInference block: Raise.() -> A, @@ -82,6 +113,16 @@ public inline fun fold( return fold(block, { throw it }, recover, transform) } +/** + * The most general way to execute a computation using [Raise]. + * Depending on the outcome of the block, one of the three continuations is run: + * - _success_ [transform] result of [A] to a value of [B]. + * - _raised_ [recover] from `raised` value of [Error] to a value of [B]. + * - _exception_ [catch] from [Throwable] by transforming value into [B]. + * + * This method should never be wrapped in `try`/`catch` as it will not throw any unexpected errors, + * it will only result in [CancellationException], or fatal exceptions such as `OutOfMemoryError`. + */ @JvmName("_fold") public inline fun fold( @BuilderInference block: Raise.() -> A, diff --git a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Mappers.kt b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Mappers.kt index 4efa6d67340..c6cb52e977a 100644 --- a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Mappers.kt +++ b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Mappers.kt @@ -13,16 +13,19 @@ import kotlin.jvm.JvmName /** Run the [Effect] by returning [Either.Right] of [A], or [Either.Left] of [Error]. */ public suspend fun Effect.toEither(): Either = either { invoke() } +/** Run the [EagerEffect] by returning [Either.Right] of [A], or [Either.Left] of [Error]. */ public fun EagerEffect.toEither(): Either = either { invoke() } /** Run the [Effect] by returning [Validated.Valid] of [A], or [Validated.Invalid] of [Error]. */ @Deprecated(ValidatedDeprMsg, ReplaceWith("toEither()")) public suspend fun Effect.toValidated(): Validated = fold({ Validated.Invalid(it) }) { Validated.Valid(it) } +/** Run the [EagerEffect] by returning [Validated.Valid] of [A], or [Validated.Invalid] of [Error]. */ @Deprecated(ValidatedDeprMsg, ReplaceWith("toEither()")) public fun EagerEffect.toValidated(): Validated = fold({ Validated.Invalid(it) }) { Validated.Valid(it) } /** Run the [Effect] by returning [Ior.Right] of [A], or [Ior.Left] of [Error]. */ public suspend fun Effect.toIor(): Ior = fold({ Ior.Left(it) }) { Ior.Right(it) } +/** Run the [EagerEffect] by returning [Ior.Right] of [A], or [Ior.Left] of [Error]. */ public fun EagerEffect.toIor(): Ior = fold({ Ior.Left(it) }) { Ior.Right(it) } @Deprecated( @@ -45,14 +48,17 @@ public fun EagerEffect.getOrNull(): A? = getOrElse { null } /** Run the [Effect] by returning [Option] of [A], [recover] run the fallback lambda and returning its result of [Option] of [A]. */ public suspend fun Effect.toOption(recover: suspend (error: Error) -> Option): Option = fold(recover) { Some(it) } +/** Run the [EagerEffect] by returning [Option] of [A], [recover] run the fallback lambda and returning its result of [Option] of [A]. */ public inline fun EagerEffect.toOption(recover: (error: Error) -> Option): Option = fold(recover) { Some(it) } /** Run the [Effect] by returning [Result] of [A], [recover] run the fallback lambda and returning its result of [Result] of [A]. */ public suspend fun Effect.toResult(recover: suspend (error: Error) -> Result): Result = fold({ Result.failure(it) }, { recover(it) }, { Result.success(it) }) +/** Run the [EagerEffect] by returning [Result] of [A], [recover] run the fallback lambda and returning its result of [Result] of [A]. */ public inline fun EagerEffect.toResult(recover: (error: Error) -> Result): Result = fold({ Result.failure(it) }, { recover(it) }, { Result.success(it) }) /** Run the [Effect] by returning [Result] of [A], or [Result.Failure] if raised with [Throwable]. */ public suspend fun Effect.toResult(): Result = result { invoke() } +/** Run the [EagerEffect] by returning [Result] of [A], or [Result.Failure] if raised with [Throwable]. */ public fun EagerEffect.toResult(): Result = result { invoke() } diff --git a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Raise.kt b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Raise.kt index fbfae26c7b7..007f6e90581 100644 --- a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Raise.kt +++ b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Raise.kt @@ -31,7 +31,9 @@ public annotation class RaiseDSL * * The [Raise] DSL allows you to work with _logical failures_ of type [Error]. * A _logical failure_ does not necessarily mean that the computation has failed, - * but that it has stopped or _short-circuited_. + * but that it has stopped or _short-circuited_. The Arrow website has a + * [guide](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/) + * introducing [Raise] and how to use it effectively. * * The [Raise] DSL allows you to [raise] _logical failure_ of type [Error], and you can [recover] from them. * @@ -248,6 +250,13 @@ public interface Raise { */ public operator fun EagerEffect.invoke(): A = invoke(this@Raise) + /** + * Invoke an [EagerEffect] inside `this` [Raise] context. + * Any _logical failure_ is raised in `this` [Raise] context, + * and thus short-circuits the computation. + * + * @see [recover] if you want to attempt to recover from any _logical failure_. + */ @RaiseDSL public fun EagerEffect.bind(): A = invoke(this@Raise) @@ -260,6 +269,13 @@ public interface Raise { */ public suspend operator fun Effect.invoke(): A = invoke(this@Raise) + /** + * Invoke an [Effect] inside `this` [Raise] context. + * Any _logical failure_ raised are raised in `this` [Raise] context, + * and thus short-circuits the computation. + * + * @see [recover] if you want to attempt to recover from any _logical failure_. + */ @RaiseDSL public suspend fun Effect.bind(): A = invoke(this@Raise) @@ -296,6 +312,11 @@ public interface Raise { is Either.Right -> value } + /** + * Extracts all the values in the [Map], raising every [Either.Left] + * as a _logical failure_. In other words, executed [bind] over every + * value in this [Map]. + */ public fun Map>.bindAll(): Map = mapValues { (_, a) -> a.bind() } @@ -306,14 +327,29 @@ public interface Raise { is Validated.Valid -> value } + /** + * Extracts all the values in the [Iterable], raising every [Either.Left] + * as a _logical failure_. In other words, executed [bind] over every + * value in this [Iterable]. + */ @RaiseDSL public fun Iterable>.bindAll(): List = map { it.bind() } + /** + * Extracts all the values in the [NonEmptyList], raising every [Either.Left] + * as a _logical failure_. In other words, executed [bind] over every + * value in this [NonEmptyList]. + */ @RaiseDSL public fun NonEmptyList>.bindAll(): NonEmptyList = map { it.bind() } + /** + * Extracts all the values in the [NonEmptySet], raising every [Either.Left] + * as a _logical failure_. In other words, executed [bind] over every + * value in this [NonEmptySet]. + */ @RaiseDSL public fun NonEmptySet>.bindAll(): NonEmptySet = map { it.bind() }.toNonEmptySet() diff --git a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/RaiseAccumulate.kt b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/RaiseAccumulate.kt index ce7d09bc38a..f477e2b5306 100644 --- a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/RaiseAccumulate.kt +++ b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/RaiseAccumulate.kt @@ -27,6 +27,10 @@ import kotlin.jvm.JvmName /** * Accumulate the errors from running both [action1] and [action2] using the given [combine] function. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise.zipOrAccumulate( @@ -47,6 +51,10 @@ public inline fun Raise.zipOrAccumulate( /** * Accumulate the errors from running [action1], [action2], and [action3] using the given [combine]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise.zipOrAccumulate( @@ -69,6 +77,10 @@ public inline fun Raise.zipOrAccumulate( /** * Accumulate the errors from running [action1], [action2], [action3], and [action4] using the given [combine]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise.zipOrAccumulate( @@ -93,6 +105,10 @@ public inline fun Raise.zipOrAccumulate( /** * Accumulate the errors from running [action1], [action2], [action3], [action4], and [action5] using the given [combine]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise.zipOrAccumulate( @@ -119,6 +135,10 @@ public inline fun Raise.zipOrAccumulate( /** * Accumulate the errors from running [action1], [action2], [action3], [action4], [action5], and [action6] using the given [combine]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise.zipOrAccumulate( @@ -147,6 +167,10 @@ public inline fun Raise.zipOrAccumulate( /** * Accumulate the errors from running [action1], [action2], [action3], [action4], [action5], [action6], and [action7] using the given [combine]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise.zipOrAccumulate( @@ -177,6 +201,10 @@ public inline fun Raise.zipOrAccumulate( /** * Accumulate the errors from running [action1], [action2], [action3], [action4], [action5], [action6], [action7], and [action8] using the given [combine]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise.zipOrAccumulate( @@ -209,6 +237,10 @@ public inline fun Raise.zipOrAccumulat /** * Accumulate the errors from running [action1], [action2], [action3], [action4], [action5], [action6], [action7], [action8], and [action9] using the given [combine]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise.zipOrAccumulate( @@ -241,6 +273,10 @@ public inline fun Raise.zipOrAccumu /** * Accumulate the errors from running both [action1] and [action2]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.zipOrAccumulate( @@ -259,6 +295,10 @@ public inline fun Raise>.zipOrAccumulate( /** * Accumulate the errors from running [action1], [action2], and [action3]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.zipOrAccumulate( @@ -279,6 +319,10 @@ public inline fun Raise>.zipOrAccumulate /** * Accumulate the errors from running [action1], [action2], [action3], and [action4]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.zipOrAccumulate( @@ -301,6 +345,10 @@ public inline fun Raise>.zipOrAccumul /** * Accumulate the errors from running [action1], [action2], [action3], [action4], and [action5]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.zipOrAccumulate( @@ -325,6 +373,10 @@ public inline fun Raise>.zipOrAccu /** * Accumulate the errors from running [action1], [action2], [action3], [action4], [action5], and [action6]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.zipOrAccumulate( @@ -351,6 +403,10 @@ public inline fun Raise>.zipOrA /** * Accumulate the errors from running [action1], [action2], [action3], [action4], [action5], [action6], and [action7]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.zipOrAccumulate( @@ -379,6 +435,10 @@ public inline fun Raise>.zip /** * Accumulate the errors from running [action1], [action2], [action3], [action4], [action5], [action6], [action7], and [action8]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.zipOrAccumulate( @@ -409,6 +469,10 @@ public inline fun Raise>. /** * Accumulate the errors from running [action1], [action2], [action3], [action4], [action5], [action6], [action7], [action8], and [action9]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.zipOrAccumulate( @@ -440,6 +504,10 @@ public inline fun Raise Raise.mapOrAccumulate( @@ -461,6 +529,10 @@ public inline fun Raise.mapOrAccumulate( /** * Accumulate the errors obtained by executing the [transform] over every element of [iterable]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.mapOrAccumulate( @@ -481,6 +553,10 @@ public inline fun Raise>.mapOrAccumulate( /** * Accumulate the errors obtained by executing the [transform] over every element of [NonEmptyList]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.mapOrAccumulate( @@ -490,6 +566,10 @@ public inline fun Raise>.mapOrAccumulate( /** * Accumulate the errors obtained by executing the [transform] over every element of [NonEmptySet]. + * + * See the Arrow docs for more information over + * [error accumulation](https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/#accumulating-errors) + * and how to use it in [validation](https://arrow-kt.io/learn/typed-errors/validation/). */ @RaiseDSL public inline fun Raise>.mapOrAccumulate(