Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ jobs:
path: '**/build/reports/**'

- name: Update API files
run: ./gradlew updateLegacyAbi
run: ./gradlew updateKotlinAbi

- name: Commit updated API files
uses: stefanzweifel/git-auto-commit-action@v7
Expand Down
4 changes: 2 additions & 2 deletions arrow-libs/core/arrow-autoclose/api/jvm/arrow-autoclose.api
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ public abstract interface annotation class arrow/AutoCloseImplementation : java/
}

public abstract interface class arrow/AutoCloseScope {
public abstract fun autoClose (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
public abstract fun install (Ljava/lang/AutoCloseable;)Ljava/lang/AutoCloseable;
public fun autoClose (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
public fun install (Ljava/lang/AutoCloseable;)Ljava/lang/AutoCloseable;
public abstract fun onClose (Lkotlin/jvm/functions/Function1;)V
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public value class Cache4kMemoizationCache<K: Any, V: Any>(

@OptIn(ExperimentalTypeInference::class)
public fun <K: Any, V: Any> buildCache4K(
@BuilderInference configure: Cache.Builder<K, V>.() -> Unit
configure: Cache.Builder<K, V>.() -> Unit
): Cache<K, V> = Cache.Builder<K, V>().apply(configure).build()

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions arrow-libs/core/arrow-core/api/jvm/arrow-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -350,20 +350,20 @@ public final class arrow/core/MemoizedDeepRecursiveFunctionKt {
}

public abstract interface class arrow/core/NonEmptyCollection : java/util/Collection, kotlin/jvm/internal/markers/KMappedMarker {
public abstract fun distinct-1X0FA-Y ()Ljava/util/List;
public abstract fun distinctBy-0-xjo5U (Lkotlin/jvm/functions/Function1;)Ljava/util/List;
public abstract fun firstOrNull ()Ljava/lang/Object;
public abstract fun flatMap-0-xjo5U (Lkotlin/jvm/functions/Function1;)Ljava/util/List;
public fun distinct-1X0FA-Y ()Ljava/util/List;
public fun distinctBy-0-xjo5U (Lkotlin/jvm/functions/Function1;)Ljava/util/List;
public fun firstOrNull ()Ljava/lang/Object;
public fun flatMap-0-xjo5U (Lkotlin/jvm/functions/Function1;)Ljava/util/List;
public abstract fun getHead ()Ljava/lang/Object;
public abstract fun isEmpty ()Z
public fun isEmpty ()Z
public abstract fun lastOrNull ()Ljava/lang/Object;
public abstract fun map-0-xjo5U (Lkotlin/jvm/functions/Function1;)Ljava/util/List;
public abstract fun mapIndexed-0-xjo5U (Lkotlin/jvm/functions/Function2;)Ljava/util/List;
public fun map-0-xjo5U (Lkotlin/jvm/functions/Function1;)Ljava/util/List;
public fun mapIndexed-0-xjo5U (Lkotlin/jvm/functions/Function2;)Ljava/util/List;
public abstract fun plus (Ljava/lang/Iterable;)Larrow/core/NonEmptyCollection;
public abstract fun plus (Ljava/lang/Object;)Larrow/core/NonEmptyCollection;
public abstract fun toNonEmptyList-1X0FA-Y ()Ljava/util/List;
public abstract fun toNonEmptySet-5sCjGKo ()Ljava/util/Set;
public abstract fun zip (Larrow/core/NonEmptyCollection;)Larrow/core/NonEmptyCollection;
public fun toNonEmptyList-1X0FA-Y ()Ljava/util/List;
public fun toNonEmptySet-5sCjGKo ()Ljava/util/Set;
public fun zip (Larrow/core/NonEmptyCollection;)Larrow/core/NonEmptyCollection;
}

public final class arrow/core/NonEmptyCollection$DefaultImpls {
Expand Down Expand Up @@ -952,15 +952,15 @@ public final class arrow/core/raise/IorRaise : arrow/core/raise/Raise {
}

public abstract interface class arrow/core/raise/Raise {
public abstract fun bind (Larrow/core/Either;)Ljava/lang/Object;
public abstract fun bind (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public abstract fun bind (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun bindAll (Ljava/lang/Iterable;)Ljava/util/List;
public abstract fun bindAll (Ljava/util/Map;)Ljava/util/Map;
public abstract fun bindAll-1TN0_VU (Ljava/util/Set;)Ljava/util/Set;
public abstract fun bindAll-vcjLgH4 (Ljava/util/List;)Ljava/util/List;
public abstract fun invoke (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public abstract fun invoke (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun bind (Larrow/core/Either;)Ljava/lang/Object;
public fun bind (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public fun bind (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun bindAll (Ljava/lang/Iterable;)Ljava/util/List;
public fun bindAll (Ljava/util/Map;)Ljava/util/Map;
public fun bindAll-1TN0_VU (Ljava/util/Set;)Ljava/util/Set;
public fun bindAll-vcjLgH4 (Ljava/util/List;)Ljava/util/List;
public fun invoke (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public fun invoke (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun raise (Ljava/lang/Object;)Ljava/lang/Void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ public fun <E> E.leftNel(): EitherNel<E, Nothing> =
* <!--- TEST lines.isEmpty() -->
*/
@OptIn(ExperimentalTypeInference::class)
public inline fun <E, EE, A> Either<E, A>.recover(@BuilderInference recover: Raise<EE>.(E) -> A): Either<EE, A> {
public inline fun <E, EE, A> Either<E, A>.recover(recover: Raise<EE>.(E) -> A): Either<EE, A> {
contract {
callsInPlace(recover, InvocationKind.AT_MOST_ONCE)
(this@recover is Left) holdsIn recover
Expand Down Expand Up @@ -1614,7 +1614,7 @@ public inline fun <E, EE, A> Either<E, A>.recover(@BuilderInference recover: Rai
* <!--- TEST lines.isEmpty() -->
*/
@OptIn(ExperimentalTypeInference::class)
public inline fun <E, reified T : Throwable, A> Either<Throwable, A>.catch(@BuilderInference catch: Raise<E>.(T) -> A): Either<E, A> {
public inline fun <E, reified T : Throwable, A> Either<Throwable, A>.catch(catch: Raise<E>.(T) -> A): Either<E, A> {
contract {
callsInPlace(catch, InvocationKind.AT_MOST_ONCE)
(this@catch is Left) holdsIn catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public fun <T> Iterable<T>.collectionSizeOrDefault(default: Int): Int =
@OptIn(ExperimentalTypeInference::class)
public inline fun <Error, A, B> Iterable<A>.mapOrAccumulate(
combine: (Error, Error) -> Error,
@BuilderInference transform: RaiseAccumulate<Error>.(A) -> B,
transform: RaiseAccumulate<Error>.(A) -> B,
): Either<Error, List<B>> = either {
mapOrAccumulate(this@mapOrAccumulate, combine, transform)
}
Expand Down Expand Up @@ -351,7 +351,7 @@ public inline fun <Error, A, B> Iterable<A>.mapOrAccumulate(
*/
@OptIn(ExperimentalTypeInference::class)
public inline fun <Error, A, B> Iterable<A>.mapOrAccumulate(
@BuilderInference transform: RaiseAccumulate<Error>.(A) -> B,
transform: RaiseAccumulate<Error>.(A) -> B,
): Either<NonEmptyList<Error>, List<B>> = either {
mapOrAccumulate(this@mapOrAccumulate, transform)
}
Expand Down Expand Up @@ -820,6 +820,7 @@ public fun <A> Iterable<A>.interleave(other: Iterable<A>): List<A> =
@Deprecated("To be removed due to unclear semantics. Please report use cases at https://github.com/arrow-kt/arrow/issues/3675.")
public fun <A, B> Iterable<A>.unweave(ffa: (A) -> Iterable<B>): List<B> =
split()?.let { (fa, a) ->
@Suppress("DEPRECATION")
ffa(a).interleave(fa.unweave(ffa))
} ?: emptyList()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,12 @@ public inline fun <A, B, E> NonEmptyList<E>.unzip(f: (E) -> Pair<A, B>): Pair<No

public inline fun <Error, E, T> NonEmptyList<E>.mapOrAccumulate(
combine: (Error, Error) -> Error,
@BuilderInference transform: RaiseAccumulate<Error>.(E) -> T
transform: RaiseAccumulate<Error>.(E) -> T
): Either<Error, NonEmptyList<T>> =
all.mapOrAccumulate(combine, transform).map(::NonEmptyList)

public inline fun <Error, E, T> NonEmptyList<E>.mapOrAccumulate(
@BuilderInference transform: RaiseAccumulate<Error>.(E) -> T
transform: RaiseAccumulate<Error>.(E) -> T
): Either<NonEmptyList<Error>, NonEmptyList<T>> =
all.mapOrAccumulate(transform).map(::NonEmptyList)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ public value class NonEmptySet<out E> internal constructor(

public inline fun <Error, E, T> NonEmptySet<E>.mapOrAccumulate(
combine: (Error, Error) -> Error,
@BuilderInference transform: RaiseAccumulate<Error>.(E) -> T
transform: RaiseAccumulate<Error>.(E) -> T
): Either<Error, NonEmptySet<T>> = either {
withError({ it.reduce(combine) }) { mapOrAccumulate(this@mapOrAccumulate, transform) }
}

public inline fun <Error, E, T> NonEmptySet<E>.mapOrAccumulate(
@BuilderInference transform: RaiseAccumulate<Error>.(E) -> T
transform: RaiseAccumulate<Error>.(E) -> T
): Either<NonEmptyList<Error>, NonEmptySet<T>> = either {
mapOrAccumulate(this@mapOrAccumulate, transform)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,13 +610,13 @@ public fun <A> Sequence<A>.tail(): Sequence<A> =

public fun <Error, A, B> Sequence<A>.mapOrAccumulate(
combine: (Error, Error) -> Error,
@BuilderInference transform: RaiseAccumulate<Error>.(A) -> B
transform: RaiseAccumulate<Error>.(A) -> B
): Either<Error, List<B>> = either {
mapOrAccumulate(this@mapOrAccumulate, combine, transform)
}

public fun <Error, A, B> Sequence<A>.mapOrAccumulate(
@BuilderInference transform: RaiseAccumulate<Error>.(A) -> B
transform: RaiseAccumulate<Error>.(A) -> B
): Either<NonEmptyList<Error>, List<B>> = either {
mapOrAccumulate(this@mapOrAccumulate, transform)
}
Expand Down Expand Up @@ -684,6 +684,7 @@ public fun <A, B, C> Sequence<C>.unalign(fa: (C) -> Ior<A, B>): Pair<Sequence<A>
@Deprecated("To be removed due to unclear semantics. Please report use cases at https://github.com/arrow-kt/arrow/issues/3675.")
public fun <A, B> Sequence<A>.unweave(ffa: (A) -> Sequence<B>): Sequence<B> =
split()?.let { (fa, a) ->
@Suppress("DEPRECATION")
ffa(a).interleave(fa.unweave(ffa))
} ?: emptySequence()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,26 +261,26 @@ public fun <K, A, B> Map<K, A>.flatMapValues(f: (Map.Entry<K, A>) -> Map<K, B>):
)
public inline fun <K, E, A, B> Map<K, A>.mapOrAccumulate(
combine: (E, E) -> E,
@BuilderInference transform: RaiseAccumulate<E>.(Map.Entry<K, A>) -> B
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
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
transform: RaiseAccumulate<E>.(Map.Entry<K, A>) -> B
): Either<E, Map<K, B>> = either {
mapValuesOrAccumulate(this@mapValuesOrAccumulate, combine, transform)
}

public inline fun <K, E, A, B> Map<K, A>.mapValuesOrAccumulate(
@BuilderInference transform: RaiseAccumulate<E>.(Map.Entry<K, A>) -> B
transform: RaiseAccumulate<E>.(Map.Entry<K, A>) -> B
): Either<NonEmptyList<E>, Map<K, B>> = either {
mapValuesOrAccumulate(this@mapValuesOrAccumulate, transform)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import kotlin.jvm.JvmName
@RaiseDSL
public inline fun <A> singleton(
raise: () -> A,
@BuilderInference block: SingletonRaise<A>.() -> A,
block: SingletonRaise<A>.() -> A,
): A {
contract {
callsInPlace(raise, InvocationKind.AT_MOST_ONCE)
Expand All @@ -48,7 +48,7 @@ public inline fun <A> singleton(
* 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 <Error, A> either(@BuilderInference block: Raise<Error>.() -> A): Either<Error, A> {
public inline fun <Error, A> either(block: Raise<Error>.() -> A): Either<Error, A> {
contract { callsInPlace(block, InvocationKind.AT_MOST_ONCE) }
return fold(block, { Either.Left(it) }, { Either.Right(it) })
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public inline fun <A> option(block: SingletonRaise<None>.() -> A): Option<A> {
* 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 <Error, A> ior(noinline combineError: (Error, Error) -> Error, @BuilderInference block: IorRaise<Error>.() -> A): Ior<Error, A> {
public inline fun <Error, A> ior(noinline combineError: (Error, Error) -> Error, block: IorRaise<Error>.() -> A): Ior<Error, A> {
contract { callsInPlace(block, InvocationKind.AT_MOST_ONCE) }
val state: Atomic<Any?> = Atomic(EmptyValue)
return fold(
Expand All @@ -138,7 +138,7 @@ public inline fun <Error, A> ior(noinline combineError: (Error, Error) -> Error,
* 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 <Error, A> iorNel(noinline combineError: (NonEmptyList<Error>, NonEmptyList<Error>) -> NonEmptyList<Error> = { a, b -> a + b }, @BuilderInference block: IorRaise<NonEmptyList<Error>>.() -> A): IorNel<Error, A> {
public inline fun <Error, A> iorNel(noinline combineError: (NonEmptyList<Error>, NonEmptyList<Error>) -> NonEmptyList<Error> = { a, b -> a + b }, block: IorRaise<NonEmptyList<Error>>.() -> A): IorNel<Error, A> {
contract { callsInPlace(block, InvocationKind.AT_MOST_ONCE) }
return ior(combineError, block)
}
Expand Down Expand Up @@ -330,7 +330,7 @@ public class ResultRaise(private val raise: Raise<Throwable>) : Raise<Throwable>

@RaiseDSL
public inline fun <A> recover(
@BuilderInference block: ResultRaise.() -> A,
block: ResultRaise.() -> A,
recover: (Throwable) -> A,
): A {
contract {
Expand Down Expand Up @@ -392,7 +392,7 @@ public class IorRaise<Error> @PublishedApi internal constructor(

@RaiseDSL
public inline fun <A> recover(
@BuilderInference block: IorRaise<Error>.() -> A,
block: IorRaise<Error>.() -> A,
recover: (error: Error) -> A,
): A {
contract {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,13 +665,13 @@ import kotlin.jvm.JvmName
public typealias Effect<Error, A> = suspend Raise<Error>.() -> A

@Suppress("NOTHING_TO_INLINE")
public inline fun <Error, A> effect(@BuilderInference noinline block: suspend Raise<Error>.() -> A): Effect<Error, A> = block
public inline fun <Error, A> effect(noinline block: suspend Raise<Error>.() -> A): Effect<Error, A> = block

/** The same behavior and API as [Effect] except without requiring _suspend_. */
public typealias EagerEffect<Error, A> = Raise<Error>.() -> A

@Suppress("NOTHING_TO_INLINE")
public inline fun <Error, A> eagerEffect(@BuilderInference noinline block: Raise<Error>.() -> A): EagerEffect<Error, A> = block
public inline fun <Error, A> eagerEffect(noinline block: Raise<Error>.() -> A): EagerEffect<Error, A> = block

public suspend fun <A> Effect<A, A>.merge(): A = merge { invoke() }
public fun <A> EagerEffect<A, A>.merge(): A = merge { invoke() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import kotlin.jvm.JvmName
* ```
* <!--- KNIT example-effect-error-01.kt -->
*/
public infix fun <Error, OtherError, A> Effect<Error, A>.recover(@BuilderInference recover: suspend Raise<OtherError>.(error: Error) -> A): Effect<OtherError, A> =
public infix fun <Error, OtherError, A> Effect<Error, A>.recover(recover: suspend Raise<OtherError>.(error: Error) -> A): Effect<OtherError, A> =
effect { recover({ invoke() }) { recover(it) } }

/**
Expand All @@ -56,7 +56,7 @@ public infix fun <Error, OtherError, A> Effect<Error, A>.recover(@BuilderInferen
* ```
* <!--- KNIT example-effect-error-02.kt -->
*/
public infix fun <Error, A> Effect<Error, A>.catch(@BuilderInference catch: suspend Raise<Error>.(throwable: Throwable) -> A): Effect<Error, A> =
public infix fun <Error, A> Effect<Error, A>.catch(catch: suspend Raise<Error>.(throwable: Throwable) -> A): Effect<Error, A> =
effect { catch({ invoke() }) { catch(it) } }

/**
Expand Down Expand Up @@ -86,7 +86,7 @@ public infix fun <Error, A> Effect<Error, A>.catch(@BuilderInference catch: susp
*/
@JvmName("catchReified")
public inline infix fun <reified T : Throwable, Error, A> Effect<Error, A>.catch(
@BuilderInference crossinline catch: suspend Raise<Error>.(t: T) -> A,
crossinline catch: suspend Raise<Error>.(t: T) -> A,
): Effect<Error, A> =
effect { catch({ invoke() }) { t: T -> catch(t) } }

Expand Down Expand Up @@ -124,15 +124,15 @@ public suspend inline infix fun <Error, A> Effect<Error, A>.getOrElse(recover: (
public infix fun <Error, OtherError, A> Effect<Error, A>.mapError(transform: suspend (error: Error) -> OtherError): Effect<OtherError, A> =
effect { withError({ transform(it) }) { invoke() } }

public infix fun <Error, OtherError, A> EagerEffect<Error, A>.recover(@BuilderInference recover: Raise<OtherError>.(error: Error) -> A): EagerEffect<OtherError, A> =
public infix fun <Error, OtherError, A> EagerEffect<Error, A>.recover(recover: Raise<OtherError>.(error: Error) -> A): EagerEffect<OtherError, A> =
eagerEffect { recover({ invoke() }) { recover(it) } }

public infix fun <Error, A> EagerEffect<Error, A>.catch(@BuilderInference catch: Raise<Error>.(throwable: Throwable) -> A): EagerEffect<Error, A> =
public infix fun <Error, A> EagerEffect<Error, A>.catch(catch: Raise<Error>.(throwable: Throwable) -> A): EagerEffect<Error, A> =
eagerEffect { catch({ invoke() }) { catch(it) } }

@JvmName("catchReified")
public inline infix fun <reified T : Throwable, Error, A> EagerEffect<Error, A>.catch(
@BuilderInference crossinline catch: Raise<Error>.(t: T) -> A,
crossinline catch: Raise<Error>.(t: T) -> A,
): EagerEffect<Error, A> =
eagerEffect { catch({ invoke() }) { t: T -> catch(t) } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public inline fun <Error, A, B> EagerEffect<Error, A>.fold(recover: (error: Erro
*/
@JvmName("_foldOrThrow")
public inline fun <Error, A, B> fold(
@BuilderInference block: Raise<Error>.() -> A,
block: Raise<Error>.() -> A,
recover: (error: Error) -> B,
transform: (value: A) -> B,
): B {
Expand All @@ -129,7 +129,7 @@ public inline fun <Error, A, B> fold(
@OptIn(DelicateRaiseApi::class)
@JvmName("_fold")
public inline fun <Error, A, B> fold(
@BuilderInference block: Raise<Error>.() -> A,
block: Raise<Error>.() -> A,
catch: (throwable: Throwable) -> B,
recover: (error: Error) -> B,
transform: (value: A) -> B,
Expand Down Expand Up @@ -196,7 +196,7 @@ public inline fun <Error, A, B> fold(
@OptIn(DelicateRaiseApi::class)
@ExperimentalTraceApi
public inline fun <Error, A> Raise<Error>.traced(
@BuilderInference block: Raise<Error>.() -> A,
block: Raise<Error>.() -> A,
trace: (trace: Trace, error: Error) -> Unit
): A {
contract {
Expand Down
Loading
Loading