replicate

fun <A> Eval<A>.replicate(n: Int): Eval<List<A>>
fun <A> Eval<A>.replicate(n: Int, MA: Monoid<A>): Eval<A>
fun <A, B> Ior<A, B>.replicate(SA: Semigroup<A>, n: Int): Ior<A, List<B>>
fun <A, B> Ior<A, B>.replicate(SA: Semigroup<A>, n: Int, MB: Monoid<B>): Ior<A, B>
fun <A> Iterable<A>.replicate(n: Int): List<List<A>>
fun <A> Iterable<A>.replicate(n: Int, MA: Monoid<A>): List<A>
fun <A> Option<A>.replicate(n: Int, MA: Monoid<A>): Option<A>
fun <A> Sequence<A>.replicate(n: Int, MA: Monoid<A>): Sequence<A>
fun <E, A> Validated<E, A>.replicate(SE: Semigroup<E>, n: Int): Validated<E, List<A>>
fun <E, A> Validated<E, A>.replicate(SE: Semigroup<E>, n: Int, MA: Monoid<A>): Validated<E, A>


fun <A, B> Either<A, B>.replicate(n: Int, MB: Monoid<B>): Either<A, B>

Deprecated

This API is niche and will be removed in the future. If this method is crucial for you, please let us know on the Arrow Github. Thanks! https://github.com/arrow-kt/arrow/issues Prefer using the Either DSL, or map

Replace with

if (n <= 0) Right(MB.empty()) else map { b -> List(n) { b }.fold(MB) }