Hyperlinkv0.8.0-beta.28

Array

Array.appendAllconsteffect/Array.ts:676
<S extends Iterable<any>, T extends Iterable<any>>(that: T): (
  self: S
) => ReadonlyArray.OrNonEmpty<
  S,
  T,
  ReadonlyArray.Infer<S> | ReadonlyArray.Infer<T>
>
<A, B>(self: Iterable<A>, that: NonEmptyReadonlyArray<B>): NonEmptyArray<
  A | B
>
<A, B>(self: NonEmptyReadonlyArray<A>, that: Iterable<B>): NonEmptyArray<
  A | B
>
<A, B>(self: Iterable<A>, that: Iterable<B>): Array<A | B>

Concatenates two iterables into a single array.

When to use

Use to combine two iterable inputs into a new array with the second input's elements after the first.

Details

If either input is non-empty, the result is a NonEmptyArray.

Example (Concatenating arrays)

import { Array } from "effect"

const result = Array.appendAll([1, 2], [3, 4])
console.log(result) // [1, 2, 3, 4]
Source effect/Array.ts:67611 lines
export const appendAll: {
  <S extends Iterable<any>, T extends Iterable<any>>(
    that: T
  ): (self: S) => ReadonlyArray.OrNonEmpty<S, T, ReadonlyArray.Infer<S> | ReadonlyArray.Infer<T>>
  <A, B>(self: Iterable<A>, that: NonEmptyReadonlyArray<B>): NonEmptyArray<A | B>
  <A, B>(self: NonEmptyReadonlyArray<A>, that: Iterable<B>): NonEmptyArray<A | B>
  <A, B>(self: Iterable<A>, that: Iterable<B>): Array<A | B>
} = dual(
  2,
  <A>(self: Iterable<A>, that: Iterable<A>): Array<A> => fromIterable(self).concat(fromIterable(that))
)
Referenced by 4 symbols