Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
serras committed Jun 2, 2024
1 parent c8f0253 commit 3999fb9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 23 deletions.
9 changes: 4 additions & 5 deletions arrow-libs/core/arrow-core/api/arrow-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -974,19 +974,18 @@ public class arrow/core/raise/RaiseAccumulate : arrow/core/raise/Raise {

public final class arrow/core/raise/RaiseAccumulate$Error : arrow/core/raise/RaiseAccumulate$Value {
public fun <init> (Larrow/core/raise/RaiseAccumulate;)V
public synthetic fun getResult ()Ljava/lang/Object;
public fun getResult ()Ljava/lang/Void;
public synthetic fun getValue (Ljava/lang/Void;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
public fun getValue (Ljava/lang/Void;Lkotlin/reflect/KProperty;)Ljava/lang/Void;
}

public final class arrow/core/raise/RaiseAccumulate$Ok : arrow/core/raise/RaiseAccumulate$Value {
public fun <init> (Larrow/core/raise/RaiseAccumulate;Ljava/lang/Object;)V
public fun getResult ()Ljava/lang/Object;
public fun getValue (Ljava/lang/Void;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
}

public abstract class arrow/core/raise/RaiseAccumulate$Value {
public fun <init> (Larrow/core/raise/RaiseAccumulate;)V
public abstract fun getResult ()Ljava/lang/Object;
public final fun getValue (Ljava/lang/Void;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
public abstract fun getValue (Ljava/lang/Void;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
}

public abstract class arrow/core/raise/RaiseCancellationException : java/util/concurrent/CancellationException {
Expand Down
12 changes: 4 additions & 8 deletions arrow-libs/core/arrow-core/api/arrow-core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?> (kotlin.col
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?> (kotlin.collections/Map<#A, #B>).arrow.core/fold(#C, kotlin/Function2<#C, kotlin.collections/Map.Entry<#A, #B>, #C>): #C // arrow.core/fold|[email protected]<0:0,0:1>(0:2;kotlin.Function2<0:2,kotlin.collections.Map.Entry<0:0,0:1>,0:2>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?> (kotlin/Function1<arrow.core.raise/Raise<#A>, #B>).arrow.core.raise/fold(kotlin/Function1<#A, #C>, kotlin/Function1<#B, #C>): #C // arrow.core.raise/fold|[email protected]<arrow.core.raise.Raise<0:0>,0:1>(kotlin.Function1<0:0,0:2>;kotlin.Function1<0:1,0:2>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?> (kotlin/Function1<arrow.core.raise/Raise<#A>, #B>).arrow.core.raise/fold(kotlin/Function1<kotlin/Throwable, #C>, kotlin/Function1<#A, #C>, kotlin/Function1<#B, #C>): #C // arrow.core.raise/fold|[email protected]<arrow.core.raise.Raise<0:0>,0:1>(kotlin.Function1<kotlin.Throwable,0:2>;kotlin.Function1<0:0,0:2>;kotlin.Function1<0:1,0:2>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?> arrow.core.raise/accumulate(kotlin/Function1<kotlin/Function1<arrow.core.raise/Raise<arrow.core/NonEmptyList<#A>>, #B>, #C>, noinline kotlin/Function1<arrow.core.raise/RaiseAccumulate<#A>, #B>): #C // arrow.core.raise/accumulate|accumulate(kotlin.Function1<kotlin.Function1<arrow.core.raise.Raise<arrow.core.NonEmptyList<0:0>>,0:1>,0:2>;kotlin.Function1<arrow.core.raise.RaiseAccumulate<0:0>,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?> arrow.core.raise/accumulate(kotlin/Function1<kotlin/Function1<arrow.core.raise/Raise<arrow.core/NonEmptyList<#A>>, #B>, #C>, crossinline kotlin/Function1<arrow.core.raise/RaiseAccumulate<#A>, #B>): #C // arrow.core.raise/accumulate|accumulate(kotlin.Function1<kotlin.Function1<arrow.core.raise.Raise<arrow.core.NonEmptyList<0:0>>,0:1>,0:2>;kotlin.Function1<arrow.core.raise.RaiseAccumulate<0:0>,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?> arrow.core.raise/fold(kotlin/Function1<arrow.core.raise/Raise<#A>, #B>, kotlin/Function1<#A, #C>, kotlin/Function1<#B, #C>): #C // arrow.core.raise/fold|fold(kotlin.Function1<arrow.core.raise.Raise<0:0>,0:1>;kotlin.Function1<0:0,0:2>;kotlin.Function1<0:1,0:2>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?, #C: kotlin/Any?> arrow.core.raise/fold(kotlin/Function1<arrow.core.raise/Raise<#A>, #B>, kotlin/Function1<kotlin/Throwable, #C>, kotlin/Function1<#A, #C>, kotlin/Function1<#B, #C>): #C // arrow.core.raise/fold|fold(kotlin.Function1<arrow.core.raise.Raise<0:0>,0:1>;kotlin.Function1<kotlin.Throwable,0:2>;kotlin.Function1<0:0,0:2>;kotlin.Function1<0:1,0:2>){0§<kotlin.Any?>;1§<kotlin.Any?>;2§<kotlin.Any?>}[0]
final inline fun <#A: kotlin/Any?, #B: kotlin/Any?> (arrow.core.raise/Raise<#A>).arrow.core.raise/forEachAccumulating(kotlin.collections/Iterable<#B>, kotlin/Function2<#A, #A, #A>, kotlin/Function2<arrow.core.raise/RaiseAccumulate<#A>, #B, kotlin/Unit>) // arrow.core.raise/forEachAccumulating|[email protected]<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,kotlin.Unit>){0§<kotlin.Any?>;1§<kotlin.Any?>}[0]
Expand Down Expand Up @@ -708,10 +708,8 @@ open annotation class arrow.core.raise/RaiseDSL : kotlin/Annotation { // arrow.c
}
open class <#A: kotlin/Any?> arrow.core.raise/RaiseAccumulate : arrow.core.raise/Raise<#A> { // arrow.core.raise/RaiseAccumulate|null[0]
abstract inner class <#A1: out kotlin/Any?> Value { // arrow.core.raise/RaiseAccumulate.Value|null[0]
abstract val result // arrow.core.raise/RaiseAccumulate.Value.result|{}result[0]
abstract fun <get-result>(): #A1 // arrow.core.raise/RaiseAccumulate.Value.result.<get-result>|<get-result>(){}[0]
abstract fun getValue(kotlin/Nothing?, kotlin.reflect/KProperty<*>): #A1 // arrow.core.raise/RaiseAccumulate.Value.getValue|getValue(kotlin.Nothing?;kotlin.reflect.KProperty<*>){}[0]
constructor <init>() // arrow.core.raise/RaiseAccumulate.Value.<init>|<init>(){}[0]
final fun getValue(kotlin/Nothing?, kotlin.reflect/KProperty<*>): #A1 // arrow.core.raise/RaiseAccumulate.Value.getValue|getValue(kotlin.Nothing?;kotlin.reflect.KProperty<*>){}[0]
}
constructor <init>(arrow.core.raise/Raise<arrow.core/NonEmptyList<#A>>) // arrow.core.raise/RaiseAccumulate.<init>|<init>(arrow.core.raise.Raise<arrow.core.NonEmptyList<1:0>>){}[0]
final fun <#A1: kotlin/Any> ensureNotNullOrAccumulate(#A1?, kotlin/Function0<#A>) // arrow.core.raise/RaiseAccumulate.ensureNotNullOrAccumulate|ensureNotNullOrAccumulate(0:0?;kotlin.Function0<1:0>){0§<kotlin.Any>}[0]
Expand All @@ -733,13 +731,11 @@ open class <#A: kotlin/Any?> arrow.core.raise/RaiseAccumulate : arrow.core.raise
final inline fun <#A1: kotlin/Any?> withNel(kotlin/Function1<arrow.core.raise/Raise<arrow.core/NonEmptyList<#A>>, #A1>): #A1 // arrow.core.raise/RaiseAccumulate.withNel|withNel(kotlin.Function1<arrow.core.raise.Raise<arrow.core.NonEmptyList<1:0>>,0:0>){0§<kotlin.Any?>}[0]
final inner class <#A1: out kotlin/Any?> Ok : arrow.core.raise/RaiseAccumulate.Value<#A1, #A> { // arrow.core.raise/RaiseAccumulate.Ok|null[0]
constructor <init>(#A1) // arrow.core.raise/RaiseAccumulate.Ok.<init>|<init>(1:0){}[0]
final val result // arrow.core.raise/RaiseAccumulate.Ok.result|{}result[0]
final fun <get-result>(): #A1 // arrow.core.raise/RaiseAccumulate.Ok.result.<get-result>|<get-result>(){}[0]
final fun getValue(kotlin/Nothing?, kotlin.reflect/KProperty<*>): #A1 // arrow.core.raise/RaiseAccumulate.Ok.getValue|getValue(kotlin.Nothing?;kotlin.reflect.KProperty<*>){}[0]
}
final inner class Error : arrow.core.raise/RaiseAccumulate.Value<kotlin/Nothing, #A> { // arrow.core.raise/RaiseAccumulate.Error|null[0]
constructor <init>() // arrow.core.raise/RaiseAccumulate.Error.<init>|<init>(){}[0]
final val result // arrow.core.raise/RaiseAccumulate.Error.result|{}result[0]
final fun <get-result>(): kotlin/Nothing // arrow.core.raise/RaiseAccumulate.Error.result.<get-result>|<get-result>(){}[0]
final fun getValue(kotlin/Nothing?, kotlin.reflect/KProperty<*>): kotlin/Nothing // arrow.core.raise/RaiseAccumulate.Error.getValue|getValue(kotlin.Nothing?;kotlin.reflect.KProperty<*>){}[0]
}
final val raise // arrow.core.raise/RaiseAccumulate.raise|{}raise[0]
final fun <get-raise>(): arrow.core.raise/Raise<arrow.core/NonEmptyList<#A>> // arrow.core.raise/RaiseAccumulate.raise.<get-raise>|<get-raise>(){}[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ public inline fun <Error, OtherError, A> Raise<Error>.withError(
): A {
contract {
callsInPlace(transform, AT_MOST_ONCE)
callsInPlace(block, AT_MOST_ONCE)
}
return recover(block) { raise(transform(it)) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ public inline fun <Error, A> Raise<NonEmptyList<Error>>.accumulate(

public inline fun <Error, A, R> accumulate(
raise: (Raise<NonEmptyList<Error>>.() -> A) -> R,
noinline block: RaiseAccumulate<Error>.() -> A
crossinline block: RaiseAccumulate<Error>.() -> A
): R {
contract { callsInPlace(block, AT_MOST_ONCE) }
return raise { accumulate(block) }
Expand Down Expand Up @@ -797,16 +797,14 @@ public open class RaiseAccumulate<Error>(
}

public abstract inner class Value<out A> {
public abstract val result: A
public operator fun getValue(value: Nothing?, property: KProperty<*>): A = result
public abstract operator fun getValue(value: Nothing?, property: KProperty<*>): A
}
@PublishedApi internal inner class Error: Value<Nothing>() {
override val result: Nothing
// WARNING: do not turn this into a value with initializer!!
// 'raiseErrors' is then executed eagerly, and leads to wrong behavior!!
get() {
raiseErrors()
}
// WARNING: do not turn this into a property with initializer!!
// 'raiseErrors' is then executed eagerly, and leads to wrong behavior!!
override fun getValue(value: Nothing?, property: KProperty<*>): Nothing = raiseErrors()
}
@PublishedApi internal inner class Ok<out A>(private val result: A): Value<A>() {
override fun getValue(value: Nothing?, property: KProperty<*>): A = result
}
@PublishedApi internal inner class Ok<out A>(override val result: A): Value<A>()
}

0 comments on commit 3999fb9

Please sign in to comment.