effect-io-ai

Package: effect
Module: Console

Console.withGroup

Runs an Effect inside an optionally labeled or collapsed console group, starting the group before execution and ending it after the Effect completes.

Example (Wrapping an effect in a group)

import { Console, Effect } from "effect"

const program = Effect.gen(function*() {
  yield* Console.withGroup(
    Effect.gen(function*() {
      yield* Console.log("Step 1: Initialize")
      yield* Console.log("Step 2: Process")
      yield* Console.log("Step 3: Complete")
    }),
    { label: "Processing Steps", collapsed: false }
  )
})

Signature

declare const withGroup: ((options?: { readonly label?: string | undefined; readonly collapsed?: boolean | undefined; }) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>) & (<A, E, R>(self: Effect.Effect<A, E, R>, options?: { readonly label?: string | undefined; readonly collapsed?: boolean | undefined; }) => Effect.Effect<A, E, R>)

Source

Since v2.0.0