Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Remove unit usage deprecated #333

Merged
merged 9 commits into from Dec 16, 2020
2 changes: 1 addition & 1 deletion arrow-docs/src/main/kotlin/RecursionHelper.kt
Expand Up @@ -60,7 +60,7 @@ fun <A, B> lift(arg0: Function1<A, B>): Function1<Kind<ForIntListPattern, A>, Ki
"EXTENSION_SHADOWED_BY_MEMBER"
)
fun <A> Kind<ForIntListPattern, A>.void(): IntListPattern<Unit> = IntListPattern.functor().run {
unit<A>() as IntListPattern<kotlin.Unit>
void<A>() as IntListPattern<kotlin.Unit>
}

@JvmName("fproduct")
Expand Down
Expand Up @@ -688,7 +688,7 @@ object ConcurrentLaws {
promiseB.get().followedBy(promiseA.complete(Unit)).bracket(use = { unit() }, release = { unit() }),
promiseB.complete(Unit).followedBy(promiseC.get()).bracket(use = { unit() }, release = { unit() })
)
).parTraverse(ListK.traverse(), ::identity).unit().invoke()
).parTraverse(ListK.traverse(), ::identity).void().invoke()
}.equalUnderTheLaw(unit(), EQ)
}

Expand All @@ -699,7 +699,7 @@ object ConcurrentLaws {
(10 downTo 0).toList().k().parTraverse(ListK.traverse()) { i ->
if (i == killOn) raiseError(TestError)
else unit()
}.unit().attempt()
}.void().attempt()
.map { it shouldBe Left(TestError) }
.equalUnderTheLaw(unit(), EQ)
}
Expand All @@ -716,7 +716,7 @@ object ConcurrentLaws {
promiseB.get().followedBy(promiseA.complete(Unit)).bracket(use = { unit() }, release = { unit() }),
promiseB.complete(Unit).followedBy(promiseC.get()).bracket(use = { unit() }, release = { unit() })
)
).parSequence(ListK.traverse()).unit().invoke()
).parSequence(ListK.traverse()).void().invoke()
}.equalUnderTheLaw(unit(), EQ)
}

Expand Down
2 changes: 1 addition & 1 deletion arrow-fx/src/main/kotlin/arrow/fx/extensions/fiber.kt
Expand Up @@ -45,7 +45,7 @@ fun <F> Fiber.Companion.apply(C: Concurrent<F>): Apply<Kind<ForFiber, F>> =

Fiber(
parMapN(dispatchers().default(), fa2, fb2, f),
tupledN(fix().cancel(), fb.fix().cancel()).unit()
tupledN(fix().cancel(), fb.fix().cancel()).void()
)
}
}
Expand Down
5 changes: 2 additions & 3 deletions arrow-fx/src/test/kotlin/arrow/fx/SemaphoreTest.kt
Expand Up @@ -9,7 +9,6 @@ import arrow.fx.extensions.io.applicativeError.handleError
import arrow.fx.extensions.io.async.async
import arrow.fx.extensions.io.concurrent.concurrent
import arrow.fx.extensions.io.concurrent.parMapN
import arrow.fx.extensions.io.functor.unit
import arrow.fx.extensions.io.monad.flatMap
import arrow.fx.extensions.io.monad.map
import arrow.fx.test.eq.eq
Expand Down Expand Up @@ -123,8 +122,8 @@ class SemaphoreTest : ArrowFxSpec() {
val permits: List<Long> = listOf(1, 0, 20, 4, 0, 5, 2, 1, 1, 3)
semaphore(0).flatMap { s ->
Dispatchers.Default.parMapN(
permits.traverse(IO.applicative()) { s.acquireN(it) }.unit(),
permits.reversed().traverse(IO.applicative()) { s.releaseN(it) }.unit()
permits.traverse(IO.applicative()) { s.acquireN(it) }.void(),
permits.reversed().traverse(IO.applicative()) { s.releaseN(it) }.void()
) { _, _ -> Unit }
.flatMap {
s.count()
Expand Down