arrow-core-data / arrow.core / SequenceK


@higherkind data class SequenceK<out A> : Sequence<A>


<init> SequenceK(sequence: Sequence<A>)


sequence val sequence: Sequence<A>


ap fun <B> ap(ff: <ERROR CLASS><(A) -> B>): SequenceK<B>
filterMap fun <B> filterMap(f: (A) -> Option<B>): SequenceK<B>
flatMap fun <B> flatMap(f: (A) -> <ERROR CLASS><B>): SequenceK<B>
foldLeft fun <B> foldLeft(b: B, f: (B, A) -> B): B
foldRight fun <B> foldRight(lb: Eval<B>, f: (A, Eval<B>) -> Eval<B>): Eval<B>
map fun <B> map(f: (A) -> B): SequenceK<B>
map2 fun <B, Z> map2(fb: <ERROR CLASS><B>, f: (Tuple2<A, B>) -> Z): SequenceK<Z>
toList fun toList(): List<A>
traverse Note: This will always evaluate the entire sequence because it uses applicative internally which takes only strict arguments. This will fail on infinite sequences. If you need this to work on infinite sequences your best bet is to define a new traverse instance together with a lazy version of ap from Applicative for whatever applicative you want to <G, B> traverse(GA: Applicative<G>, f: (A) -> Kind<G, B>): Kind<G, SequenceK<B>>

Companion Object Functions

empty fun <A> empty(): SequenceK<A>
just fun <A> just(a: A): SequenceK<A>
tailRecM fun <A, B> tailRecM(a: A, f: (A) -> <ERROR CLASS><Either<A, B>>): SequenceK<B>