diff --git a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Generators.kt b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Generators.kt index 3c947fe22b5..3885baf1f0f 100644 --- a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Generators.kt +++ b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Generators.kt @@ -7,6 +7,7 @@ import io.kotest.property.arbitrary.bind import io.kotest.property.arbitrary.boolean import io.kotest.property.arbitrary.choice import io.kotest.property.arbitrary.constant +import io.kotest.property.arbitrary.filter import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.list import io.kotest.property.arbitrary.set @@ -29,7 +30,9 @@ import kotlin.coroutines.startCoroutine // copied from kotest-extensions-arrow fun Arb.Companion.nonEmptyList(arb: Arb, range: IntRange = 0 .. 100): Arb> = - Arb.list(arb, max(range.first, 1) .. range.last).map { NonEmptyList(it) } + Arb.list(arb, max(range.first, 1) .. range.last) + .filter { it.isNotEmpty() } + .map { NonEmptyList(it) } fun Arb.Companion.nonEmptySet(arb: Arb, range: IntRange = 0 .. 100): Arb> = Arb.set(arb, max(range.first, 1) .. range.last).map { it.toNonEmptySetOrNull()!! }