kotest-assertions-arrow / io.kotest.assertions.arrow.nel / io.kotest.properties.Gen / nel

nel

fun <reified A> Gen.Companion.nel(GA: Gen<A>, head: A): Gen<NonEmptyList<A>>

Gen extension instance for NonEmptyList.

Generates random NonEmptyList of A as provided by the GA generators. Includes a constant head value to ensure all lists are non-empty.

import io.kotest.assertions.arrow.nel.nel
import io.kotest.properties.forAll
import io.kotest.properties.Gen

forAll(Gen.nel(Gen.int(), 0)) { it.contains(0) }