sequence<A> function

Task<IList<A>> sequence<A>(
  1. Iterable<Task<A>> tasks
)

Returns a task that maps an Iterable of Task's, into a list of results.

The tasks are run in parallel.

expect(
  await [fromThunk(() => 'one'), fromThunk(() => 'two')]
    .chain(sequence)(),
  ['one', 'two'],
);

Implementation

Task<IList<A>> sequence<A>(
  Iterable<Task<A>> tasks,
) =>
    tasks.chain(traverseIterable(identity));