Skip to content

Commit a1e8dc8

Browse files
authored
Remove arrow fx coroutines dependency from arrow continuations (#273)
* Remove Arrow Fx Coroutines dependency from Arrow Continuations * Remove redundant test from Arrow Continuations
1 parent ce8f69b commit a1e8dc8

File tree

2 files changed

+2
-29
lines changed

2 files changed

+2
-29
lines changed

arrow-libs/core/arrow-continuations/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ dependencies {
1212
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$JUNIT_VINTAGE_VERSION"
1313
testCompileOnly "io.kotlintest:kotlintest-runner-junit5:$KOTLIN_TEST_VERSION", excludeArrow
1414
testImplementation project(":arrow-core-test")
15-
testImplementation "io.arrow-kt:arrow-fx-coroutines:$VERSION_NAME"
1615
}

arrow-libs/core/arrow-continuations/src/test/kotlin/generic/SuspendingComputationTest.kt

+2-28
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
package generic
22

3-
import arrow.continuations.generic.ShortCircuit
43
import arrow.core.Left
54
import arrow.core.Right
65
import arrow.core.computations.either
7-
import arrow.fx.coroutines.ComputationPool
8-
import arrow.fx.coroutines.ExitCase
9-
import arrow.fx.coroutines.Promise
10-
import arrow.fx.coroutines.bracketCase
116
import io.kotlintest.fail
12-
import io.kotlintest.matchers.types.shouldBeInstanceOf
137
import io.kotlintest.shouldBe
148
import io.kotlintest.shouldThrow
159
import io.kotlintest.specs.StringSpec
@@ -125,26 +119,6 @@ class SuspendingComputationTest : StringSpec({
125119
} shouldBe Left("test")
126120
}
127121

128-
"Short-circuiting cancels Arrow Fx Coroutines" {
129-
val exit = Promise<ExitCase>()
130-
131-
either<String, Int> {
132-
val i: Int = bracketCase(
133-
acquire = { Unit },
134-
use = {
135-
Left("hello").invoke()
136-
},
137-
release = { _, exitCase -> exit.complete(exitCase) }
138-
)
139-
140-
5
141-
} shouldBe Left("hello")
142-
143-
exit.get().shouldBeInstanceOf<ExitCase.Failure> {
144-
it.failure.shouldBeInstanceOf<ShortCircuit>()
145-
}
146-
}
147-
148122
"Short-circuiting cancels KotlinX Coroutines" {
149123
val scope = CoroutineScope(Dispatchers.Default)
150124
val latch = CompletableDeferred<Unit>()
@@ -192,7 +166,7 @@ suspend fun completeOnCancellation(latch: CompletableDeferred<Unit>, cancelled:
192166

193167
internal suspend fun Throwable.suspend(): Nothing =
194168
suspendCoroutineUninterceptedOrReturn { cont ->
195-
suspend { throw this }.startCoroutine(Continuation(ComputationPool) {
169+
suspend { throw this }.startCoroutine(Continuation(Dispatchers.Default) {
196170
cont.intercepted().resumeWith(it)
197171
})
198172

@@ -201,7 +175,7 @@ internal suspend fun Throwable.suspend(): Nothing =
201175

202176
internal suspend fun <A> A.suspend(): A =
203177
suspendCoroutineUninterceptedOrReturn { cont ->
204-
suspend { this }.startCoroutine(Continuation(ComputationPool) {
178+
suspend { this }.startCoroutine(Continuation(Dispatchers.Default) {
205179
cont.intercepted().resumeWith(it)
206180
})
207181

0 commit comments

Comments
 (0)