arrow-fx-coroutines / arrow.fx.coroutines.stream / cons

cons

fun <O, B> Pull<O, B>.cons(c: Chunk<O>): Pull<O, B> fun <O, B> Pull<O, B>.cons(o: O): Pull<O, B>fun <O> Stream<O>.cons(c: Chunk<O>): Stream<O>

Prepends a Chunk onto the front of this stream.

import arrow.fx.coroutines.stream.*

//sampleStart
suspend fun main(): Unit =
  Stream(1, 2, 3).cons(Chunk(-1, 0))
    .toList().let(::println) // [-1, 0, 1, 2, 3]
//sampleEnd

Do you like Arrow?

Arrow Org
<