<B>(last: B): <A>(self: Iterable<A>) => Iterable<A | B>
<A, B>(self: Iterable<A>, last: B): Iterable<A | B>Appends an element to the end of an Iterable, creating a new Iterable.
When to use
Use to add one element after all elements of an iterable while keeping the
result as a lazy Iterable.
Details
The result yields every element from self first, then yields last after
self is exhausted.
Gotchas
If self is infinite or never completes, the appended element is never
reached.
Example (Appending an element)
import { Iterable } from "effect"
const numbers = [1, 2, 3]
const withFour = Iterable.append(numbers, 4)
console.log(Array.from(withFour)) // [1, 2, 3, 4]
// Chain multiple appends
const result = Iterable.append(
Iterable.append([1, 2], 3),
4
)
console.log(Array.from(result)) // [1, 2, 3, 4]export const const append: {
<B>(last: B): <A>(
self: Iterable<A>
) => Iterable<A | B>
<A, B>(self: Iterable<A>, last: B): Iterable<
A | B
>
}
Appends an element to the end of an Iterable, creating a new Iterable.
When to use
Use to add one element after all elements of an iterable while keeping the
result as a lazy Iterable.
Details
The result yields every element from self first, then yields last after
self is exhausted.
Gotchas
If self is infinite or never completes, the appended element is never
reached.
Example (Appending an element)
import { Iterable } from "effect"
const numbers = [1, 2, 3]
const withFour = Iterable.append(numbers, 4)
console.log(Array.from(withFour)) // [1, 2, 3, 4]
// Chain multiple appends
const result = Iterable.append(
Iterable.append([1, 2], 3),
4
)
console.log(Array.from(result)) // [1, 2, 3, 4]
append: {
<function (type parameter) B in <B>(last: B): <A>(self: Iterable<A>) => Iterable<A | B>B>(last: Blast: function (type parameter) B in <B>(last: B): <A>(self: Iterable<A>) => Iterable<A | B>B): <function (type parameter) A in <A>(self: Iterable<A>): Iterable<A | B>A>(self: Iterable<A>self: interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A>(self: Iterable<A>): Iterable<A | B>A>) => interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A>(self: Iterable<A>): Iterable<A | B>A | function (type parameter) B in <B>(last: B): <A>(self: Iterable<A>) => Iterable<A | B>B>
<function (type parameter) A in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>A, function (type parameter) B in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>B>(self: Iterable<A>self: interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>A>, last: Blast: function (type parameter) B in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>B): interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>A | function (type parameter) B in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>B>
} = import dualdual(2, <function (type parameter) A in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>A, function (type parameter) B in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>B>(self: Iterable<A>self: interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>A>, last: Blast: function (type parameter) B in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>B): interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>A | function (type parameter) B in <A, B>(self: Iterable<A>, last: B): Iterable<A | B>B> => const appendAll: <A, B>(self: Iterable<A>, that: Iterable<B>) => Iterable<A | B> (+1 overload)appendAll(self: Iterable<A>self, [last: Blast]))