Skip to content

Commit

Permalink
Deprecate mapOrAccumulate for Map (#3513)
Browse files Browse the repository at this point in the history
  • Loading branch information
tKe authored Nov 1, 2024
1 parent bc9bf92 commit bea9f36
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 13 deletions.
6 changes: 6 additions & 0 deletions arrow-libs/core/arrow-core/api/arrow-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ public final class arrow/core/MapKt {
public static final fun mapOrAccumulate (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Larrow/core/Either;
public static final fun mapOrAccumulate (Ljava/util/Map;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Larrow/core/Either;
public static final fun mapValuesNotNull (Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Ljava/util/Map;
public static final fun mapValuesOrAccumulate (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Larrow/core/Either;
public static final fun mapValuesOrAccumulate (Ljava/util/Map;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Larrow/core/Either;
public static final fun padZip (Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map;
public static final fun padZip (Ljava/util/Map;Ljava/util/Map;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;)Ljava/util/Map;
public static final fun padZip (Ljava/util/Map;Ljava/util/Map;Lkotlin/jvm/functions/Function3;)Ljava/util/Map;
Expand Down Expand Up @@ -972,8 +974,10 @@ public class arrow/core/raise/RaiseAccumulate : arrow/core/raise/Raise {
public fun invoke (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public fun invoke (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun mapOrAccumulate (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;)Ljava/util/List;
public final fun mapOrAccumulate (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Ljava/util/List;
public final fun mapOrAccumulate-FrVv2gs (Ljava/util/List;Lkotlin/jvm/functions/Function2;)Ljava/util/List;
public final fun mapOrAccumulate-nfMsDo0 (Ljava/util/Set;Lkotlin/jvm/functions/Function2;)Ljava/util/Set;
public final fun mapValuesOrAccumulate (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Ljava/util/Map;
public fun raise (Ljava/lang/Object;)Ljava/lang/Void;
public final fun raiseErrors ()Ljava/lang/Void;
public final fun withNel (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
Expand Down Expand Up @@ -1049,6 +1053,8 @@ public final class arrow/core/raise/RaiseKt {
public static final fun mapOrAccumulate (Larrow/core/raise/Raise;Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/util/List;
public static final fun mapOrAccumulate--YW8gn4 (Larrow/core/raise/Raise;Ljava/util/Set;Lkotlin/jvm/functions/Function2;)Ljava/util/Set;
public static final fun mapOrAccumulate-l8IBlHg (Larrow/core/raise/Raise;Ljava/util/List;Lkotlin/jvm/functions/Function2;)Ljava/util/List;
public static final fun mapValuesOrAccumulate (Larrow/core/raise/Raise;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Ljava/util/Map;
public static final fun mapValuesOrAccumulate (Larrow/core/raise/Raise;Ljava/util/Map;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/util/Map;
public static final fun merge (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun merge (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun nullable (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
Expand Down
6 changes: 6 additions & 0 deletions arrow-libs/core/arrow-core/api/arrow-core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ open class <#A: kotlin/Any?> arrow.core.raise/RaiseAccumulate : arrow.core.raise
final fun ensureOrAccumulate(kotlin/Boolean, kotlin/Function0<#A>) // arrow.core.raise/RaiseAccumulate.ensureOrAccumulate|ensureOrAccumulate(kotlin.Boolean;kotlin.Function0<1:0>){}[0]
final fun hasErrors(): kotlin/Boolean // arrow.core.raise/RaiseAccumulate.hasErrors|hasErrors(){}[0]
final fun raiseErrors(): kotlin/Nothing // arrow.core.raise/RaiseAccumulate.raiseErrors|raiseErrors(){}[0]
final inline fun <#A1: kotlin/Any?, #B1: kotlin/Any?, #C1: kotlin/Any?> (kotlin.collections/Map<#A1, #B1>).mapOrAccumulate(kotlin/Function2<arrow.core.raise/RaiseAccumulate<#A>, kotlin.collections/Map.Entry<#A1, #B1>, #C1>): kotlin.collections/List<#C1> // arrow.core.raise/RaiseAccumulate.mapOrAccumulate|mapOrAccumulate@kotlin.collections.Map<0:0,0:1>(kotlin.Function2<arrow.core.raise.RaiseAccumulate<1:0>,kotlin.collections.Map.Entry<0:0,0:1>,0:2>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>}[0]
final inline fun <#A1: kotlin/Any?, #B1: kotlin/Any?, #C1: kotlin/Any?> (kotlin.collections/Map<#A1, #B1>).mapValuesOrAccumulate(kotlin/Function2<arrow.core.raise/RaiseAccumulate<#A>, kotlin.collections/Map.Entry<#A1, #B1>, #C1>): kotlin.collections/Map<#A1, #C1> // arrow.core.raise/RaiseAccumulate.mapValuesOrAccumulate|mapValuesOrAccumulate@kotlin.collections.Map<0:0,0:1>(kotlin.Function2<arrow.core.raise.RaiseAccumulate<1:0>,kotlin.collections.Map.Entry<0:0,0:1>,0:2>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>}[0]
final inline fun <#A1: kotlin/Any?, #B1: kotlin/Any?> (arrow.core/NonEmptyList<#A1>).mapOrAccumulate(kotlin/Function2<arrow.core.raise/RaiseAccumulate<#A>, #A1, #B1>): arrow.core/NonEmptyList<#B1> // arrow.core.raise/RaiseAccumulate.mapOrAccumulate|mapOrAccumulate@arrow.core.NonEmptyList<0:0>(kotlin.Function2<arrow.core.raise.RaiseAccumulate<1:0>,0:0,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>}[0]
final inline fun <#A1: kotlin/Any?, #B1: kotlin/Any?> (arrow.core/NonEmptySet<#A1>).mapOrAccumulate(kotlin/Function2<arrow.core.raise/RaiseAccumulate<#A>, #A1, #B1>): arrow.core/NonEmptySet<#B1> // arrow.core.raise/RaiseAccumulate.mapOrAccumulate|mapOrAccumulate@arrow.core.NonEmptySet<0:0>(kotlin.Function2<arrow.core.raise.RaiseAccumulate<1:0>,0:0,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>}[0]
final inline fun <#A1: kotlin/Any?, #B1: kotlin/Any?> (kotlin.collections/Iterable<#A1>).mapOrAccumulate(kotlin/Function2<arrow.core.raise/RaiseAccumulate<#A>, #A1, #B1>): kotlin.collections/List<#B1> // arrow.core.raise/RaiseAccumulate.mapOrAccumulate|mapOrAccumulate@kotlin.collections.Iterable<0:0>(kotlin.Function2<arrow.core.raise.RaiseAccumulate<1:0>,0:0,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>}[0]
Expand Down Expand Up @@ -899,13 +901,17 @@ final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?, #E: kotlin/Any?> (kotlin.collections/Map<#A, #B>).arrow.core/zip(kotlin.collections/Map<#A, #C>, kotlin.collections/Map<#A, #D>, kotlin/Function4<#A, #B, #C, #D, #E>): kotlin.collections/Map<#A, #E> // arrow.core/zip|zip@kotlin.collections.Map<0:0,0:1>(kotlin.collections.Map<0:0,0:2>;kotlin.collections.Map<0:0,0:3>;kotlin.Function4<0:0,0:1,0:2,0:3,0:4>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>;4§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (arrow.core.raise/Raise<#A>).arrow.core.raise/zipOrAccumulate(kotlin/Function2<#A, #A, #A>, kotlin/Function1<arrow.core.raise/RaiseAccumulate<#A>, #B>, kotlin/Function1<arrow.core.raise/RaiseAccumulate<#A>, #C>, kotlin/Function2<#B, #C, #D>): #D // arrow.core.raise/zipOrAccumulate|zipOrAccumulate@arrow.core.raise.Raise<0:0>(kotlin.Function2<0:0,0:0,0:0>;kotlin.Function1<arrow.core.raise.RaiseAccumulate<0:0>,0:1>;kotlin.Function1<arrow.core.raise.RaiseAccumulate<0:0>,0:2>;kotlin.Function2<0:1,0:2,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (arrow.core.raise/Raise<#B>).arrow.core.raise/mapOrAccumulate(kotlin.collections/Map<#A, #C>, kotlin/Function2<#B, #B, #B>, kotlin/Function2<arrow.core.raise/RaiseAccumulate<#B>, kotlin.collections/Map.Entry<#A, #C>, #D>): kotlin.collections/Map<#A, #D> // arrow.core.raise/mapOrAccumulate|mapOrAccumulate@arrow.core.raise.Raise<0:1>(kotlin.collections.Map<0:0,0:2>;kotlin.Function2<0:1,0:1,0:1>;kotlin.Function2<arrow.core.raise.RaiseAccumulate<0:1>,kotlin.collections.Map.Entry<0:0,0:2>,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (arrow.core.raise/Raise<#B>).arrow.core.raise/mapValuesOrAccumulate(kotlin.collections/Map<#A, #C>, kotlin/Function2<#B, #B, #B>, kotlin/Function2<arrow.core.raise/RaiseAccumulate<#B>, kotlin.collections/Map.Entry<#A, #C>, #D>): kotlin.collections/Map<#A, #D> // arrow.core.raise/mapValuesOrAccumulate|mapValuesOrAccumulate@arrow.core.raise.Raise<0:1>(kotlin.collections.Map<0:0,0:2>;kotlin.Function2<0:1,0:1,0:1>;kotlin.Function2<arrow.core.raise.RaiseAccumulate<0:1>,kotlin.collections.Map.Entry<0:0,0:2>,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (arrow.core.raise/Raise<arrow.core/NonEmptyList<#A>>).arrow.core.raise/zipOrAccumulate(kotlin/Function1<arrow.core.raise/RaiseAccumulate<#A>, #B>, kotlin/Function1<arrow.core.raise/RaiseAccumulate<#A>, #C>, kotlin/Function2<#B, #C, #D>): #D // arrow.core.raise/zipOrAccumulate|zipOrAccumulate@arrow.core.raise.Raise<arrow.core.NonEmptyList<0:0>>(kotlin.Function1<arrow.core.raise.RaiseAccumulate<0:0>,0:1>;kotlin.Function1<arrow.core.raise.RaiseAccumulate<0:0>,0:2>;kotlin.Function2<0:1,0:2,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (arrow.core.raise/Raise<arrow.core/NonEmptyList<#B>>).arrow.core.raise/mapOrAccumulate(kotlin.collections/Map<#A, #C>, kotlin/Function2<arrow.core.raise/RaiseAccumulate<#B>, kotlin.collections/Map.Entry<#A, #C>, #D>): kotlin.collections/Map<#A, #D> // arrow.core.raise/mapOrAccumulate|mapOrAccumulate@arrow.core.raise.Raise<arrow.core.NonEmptyList<0:1>>(kotlin.collections.Map<0:0,0:2>;kotlin.Function2<arrow.core.raise.RaiseAccumulate<0:1>,kotlin.collections.Map.Entry<0:0,0:2>,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (arrow.core.raise/Raise<arrow.core/NonEmptyList<#B>>).arrow.core.raise/mapValuesOrAccumulate(kotlin.collections/Map<#A, #C>, kotlin/Function2<arrow.core.raise/RaiseAccumulate<#B>, kotlin.collections/Map.Entry<#A, #C>, #D>): kotlin.collections/Map<#A, #D> // arrow.core.raise/mapValuesOrAccumulate|mapValuesOrAccumulate@arrow.core.raise.Raise<arrow.core.NonEmptyList<0:1>>(kotlin.collections.Map<0:0,0:2>;kotlin.Function2<arrow.core.raise.RaiseAccumulate<0:1>,kotlin.collections.Map.Entry<0:0,0:2>,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (kotlin.collections/Iterable<#A>).arrow.core/zip(kotlin.collections/Iterable<#B>, kotlin.collections/Iterable<#C>, kotlin/Function3<#A, #B, #C, #D>): kotlin.collections/List<#D> // arrow.core/zip|zip@kotlin.collections.Iterable<0:0>(kotlin.collections.Iterable<0:1>;kotlin.collections.Iterable<0:2>;kotlin.Function3<0:0,0:1,0:2,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (kotlin.collections/Map<#A, #B>).arrow.core/padZip(kotlin.collections/Map<#A, #C>, kotlin/Function2<#A, #B, #D>, kotlin/Function2<#A, #C, #D>, kotlin/Function3<#A, #B, #C, #D>): kotlin.collections/Map<#A, #D> // arrow.core/padZip|padZip@kotlin.collections.Map<0:0,0:1>(kotlin.collections.Map<0:0,0:2>;kotlin.Function2<0:0,0:1,0:3>;kotlin.Function2<0:0,0:2,0:3>;kotlin.Function3<0:0,0:1,0:2,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (kotlin.collections/Map<#A, #B>).arrow.core/zip(kotlin.collections/Map<#A, #C>, kotlin/Function3<#A, #B, #C, #D>): kotlin.collections/Map<#A, #D> // arrow.core/zip|zip@kotlin.collections.Map<0:0,0:1>(kotlin.collections.Map<0:0,0:2>;kotlin.Function3<0:0,0:1,0:2,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (kotlin.collections/Map<#A, #C>).arrow.core/mapOrAccumulate(kotlin/Function2<#B, #B, #B>, kotlin/Function2<arrow.core.raise/RaiseAccumulate<#B>, kotlin.collections/Map.Entry<#A, #C>, #D>): arrow.core/Either<#B, kotlin.collections/Map<#A, #D>> // arrow.core/mapOrAccumulate|mapOrAccumulate@kotlin.collections.Map<0:0,0:2>(kotlin.Function2<0:1,0:1,0:1>;kotlin.Function2<arrow.core.raise.RaiseAccumulate<0:1>,kotlin.collections.Map.Entry<0:0,0:2>,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (kotlin.collections/Map<#A, #C>).arrow.core/mapOrAccumulate(kotlin/Function2<arrow.core.raise/RaiseAccumulate<#B>, kotlin.collections/Map.Entry<#A, #C>, #D>): arrow.core/Either<arrow.core/NonEmptyList<#B>, kotlin.collections/Map<#A, #D>> // arrow.core/mapOrAccumulate|mapOrAccumulate@kotlin.collections.Map<0:0,0:2>(kotlin.Function2<arrow.core.raise.RaiseAccumulate<0:1>,kotlin.collections.Map.Entry<0:0,0:2>,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (kotlin.collections/Map<#A, #C>).arrow.core/mapValuesOrAccumulate(kotlin/Function2<#B, #B, #B>, kotlin/Function2<arrow.core.raise/RaiseAccumulate<#B>, kotlin.collections/Map.Entry<#A, #C>, #D>): arrow.core/Either<#B, kotlin.collections/Map<#A, #D>> // arrow.core/mapValuesOrAccumulate|mapValuesOrAccumulate@kotlin.collections.Map<0:0,0:2>(kotlin.Function2<0:1,0:1,0:1>;kotlin.Function2<arrow.core.raise.RaiseAccumulate<0:1>,kotlin.collections.Map.Entry<0:0,0:2>,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (kotlin.collections/Map<#A, #C>).arrow.core/mapValuesOrAccumulate(kotlin/Function2<arrow.core.raise/RaiseAccumulate<#B>, kotlin.collections/Map.Entry<#A, #C>, #D>): arrow.core/Either<arrow.core/NonEmptyList<#B>, kotlin.collections/Map<#A, #D>> // arrow.core/mapValuesOrAccumulate|mapValuesOrAccumulate@kotlin.collections.Map<0:0,0:2>(kotlin.Function2<arrow.core.raise.RaiseAccumulate<0:1>,kotlin.collections.Map.Entry<0:0,0:2>,0:3>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (kotlin.collections/Map<#A, #D>).arrow.core/unalign(kotlin/Function1<kotlin.collections/Map.Entry<#A, #D>, arrow.core/Ior<#B, #C>>): kotlin/Pair<kotlin.collections/Map<#A, #B>, kotlin.collections/Map<#A, #C>> // arrow.core/unalign|unalign@kotlin.collections.Map<0:0,0:3>(kotlin.Function1<kotlin.collections.Map.Entry<0:0,0:3>,arrow.core.Ior<0:1,0:2>>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?, #D: kotlin/Any?> (kotlin.collections/Map<#A, #D>).arrow.core/unzip(kotlin/Function1<kotlin.collections/Map.Entry<#A, #D>, kotlin/Pair<#B, #C>>): kotlin/Pair<kotlin.collections/Map<#A, #B>, kotlin.collections/Map<#A, #C>> // arrow.core/unzip|unzip@kotlin.collections.Map<0:0,0:3>(kotlin.Function1<kotlin.collections.Map.Entry<0:0,0:3>,kotlin.Pair<0:1,0:2>>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>;3§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?> (arrow.core.raise/Raise<#A>).arrow.core.raise/mapOrAccumulate(kotlin.collections/Iterable<#B>, kotlin/Function2<#A, #A, #A>, kotlin/Function2<arrow.core.raise/RaiseAccumulate<#A>, #B, #C>): kotlin.collections/List<#C> // arrow.core.raise/mapOrAccumulate|mapOrAccumulate@arrow.core.raise.Raise<0:0>(kotlin.collections.Iterable<0:1>;kotlin.Function2<0:0,0:0,0:0>;kotlin.Function2<arrow.core.raise.RaiseAccumulate<0:0>,0:1,0:2>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>}[0]
Expand Down
24 changes: 21 additions & 3 deletions arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/map.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package arrow.core
import arrow.core.raise.either
import arrow.core.raise.mapOrAccumulate
import arrow.core.raise.RaiseAccumulate
import arrow.core.raise.mapValuesOrAccumulate
import kotlin.experimental.ExperimentalTypeInference

/**
Expand Down Expand Up @@ -254,17 +255,34 @@ public fun <K, A, B> Map<K, A>.flatMapValues(f: (Map.Entry<K, A>) -> Map<K, B>):
}
}

@Deprecated(
message = "Deprecated to allow for future alignment with stdlib Map#map returning List",
replaceWith = ReplaceWith("mapValuesOrAccumulate(combine, transform)"),
)
public inline fun <K, E, A, B> Map<K, A>.mapOrAccumulate(
combine: (E, E) -> E,
@BuilderInference transform: RaiseAccumulate<E>.(Map.Entry<K, A>) -> B
): Either<E, Map<K, B>> = mapValuesOrAccumulate(combine, transform)

@Deprecated(
message = "Deprecated to allow for future alignment with stdlib Map#map returning List",
replaceWith = ReplaceWith("mapValuesOrAccumulate(transform)"),
)
public inline fun <K, E, A, B> Map<K, A>.mapOrAccumulate(
@BuilderInference transform: RaiseAccumulate<E>.(Map.Entry<K, A>) -> B
): Either<NonEmptyList<E>, Map<K, B>> = mapValuesOrAccumulate(transform)

public inline fun <K, E, A, B> Map<K, A>.mapValuesOrAccumulate(
combine: (E, E) -> E,
@BuilderInference transform: RaiseAccumulate<E>.(Map.Entry<K, A>) -> B
): Either<E, Map<K, B>> = either {
mapOrAccumulate(this@mapOrAccumulate, combine, transform)
mapValuesOrAccumulate(this@mapValuesOrAccumulate, combine, transform)
}

public inline fun <K, E, A, B> Map<K, A>.mapOrAccumulate(
public inline fun <K, E, A, B> Map<K, A>.mapValuesOrAccumulate(
@BuilderInference transform: RaiseAccumulate<E>.(Map.Entry<K, A>) -> B
): Either<NonEmptyList<E>, Map<K, B>> = either {
mapOrAccumulate(this@mapOrAccumulate, transform)
mapValuesOrAccumulate(this@mapValuesOrAccumulate, transform)
}

public inline fun <K, A, B> Map<K, A>.mapValuesNotNull(transform: (Map.Entry<K, A>) -> B?): Map<K, B> =
Expand Down
Loading

0 comments on commit bea9f36

Please sign in to comment.