Hyperlinkv0.8.0-beta.28

Iterable

Iterable.emptyconsteffect/Iterable.ts:1413
<A = never>(): Iterable<A>

Creates an empty iterable that yields no elements.

When to use

Use when you need an empty iterable as a typed "no data" value or a base case for iterable operations.

Example (Creating an empty iterable)

import { Iterable } from "effect"

const empty = Iterable.empty<string>()
console.log(Array.from(empty)) // []
console.log(Iterable.isEmpty(empty)) // true

// Useful as base case for reductions
const hasData = true
const result = hasData
  ? Iterable.range(1, 5)
  : Iterable.empty<number>()
constructors
export const empty = <A = never>(): Iterable<A> => constEmpty