(
self: Channel<
OutElem,
OutErr,
OutDone,
InElem,
InErr,
InDone,
Env
>
)
| 2998 | * |
| 2999 | * **Example** (Flattening nested channels) |
| 3000 | * |
| 3001 | * ```ts import.meta.vitest |
| 3002 | * import { Channel, Data, Effect } from "effect" |
| 3003 | * |
| 3004 | * class FlattenError extends Data.TaggedError("FlattenError")<{ |
| 3005 | * readonly cause: string |
| 3006 | * }> {} |
| 3007 | * |
| 3008 | * // Create a channel that outputs channels |
| 3009 | * const nestedChannels = Channel.fromIterable([ |
| 3010 | * Channel.fromIterable([1, 2]), |
| 3011 | * Channel.fromIterable([3, 4]), |
| 3012 | * Channel.fromIterable([5, 6]) |
| 3013 | * ]) |
| 3014 | * |
| 3015 | * // Flatten the nested channels |
| 3016 | * const flattenedChannel = Channel.flatten(nestedChannels) |
| 3017 | * |
| 3018 | * Effect.runSync(Channel.runCollect(flattenedChannel)) // => [1, 2, 3, 4, 5, 6] |
| 3019 | * ``` |
| 3020 | * |
| 3021 | * @category constructors |
| 3022 | * @since 2.0.0 |
nothing calls this directly
no test coverage detected
searching dependent graphs…