github Effect-TS/effect effect@3.7.0

latest releases: @effect/sql-sqlite-wasm@0.20.4, @effect/typeclass@0.29.13, @effect/vitest@0.13.13...
2 months ago

Minor Changes

  • #3410 2f456cc Thanks @vinassefranche! - preserve Array.modify Array.modifyOption non emptiness

  • #3410 8745e41 Thanks @patroza! - improve: type Fiber.awaitAll as Exit<A, E>[].

  • #3410 e557838 Thanks @titouancreach! - New constructor Config.nonEmptyString

  • #3410 d6e7e40 Thanks @KhraksMamtsov! - preserve Array.replace Array.replaceOption non emptiness

  • #3410 8356321 Thanks @KhraksMamtsov! - add Effect.bindAll api

    This api allows you to combine Effect.all with Effect.bind. It is useful
    when you want to concurrently run multiple effects and then combine their
    results in a Do notation pipeline.

    import { Effect } from "effect"
    
    const result = Effect.Do.pipe(
      Effect.bind("x", () => Effect.succeed(2)),
      Effect.bindAll(
        ({ x }) => ({
          a: Effect.succeed(x + 1),
          b: Effect.succeed("foo")
        }),
        { concurrency: 2 }
      )
    )
    assert.deepStrictEqual(Effect.runSync(result), {
      x: 2,
      a: 3,
      b: "foo"
    })
  • #3410 192f2eb Thanks @tim-smart! - add propagateInterruption option to Fiber{Handle,Set,Map}

    This option will send any external interrupts to the .join result.

  • #3410 718cb70 Thanks @dilame! - feat(Stream): implement race operator, which accepts two upstreams and returns a stream that mirrors the first upstream to emit an item and interrupts the other upstream.

    import { Stream, Schedule, Console, Effect } from "effect"
    
    const stream = Stream.fromSchedule(Schedule.spaced("2 millis")).pipe(
      Stream.race(Stream.fromSchedule(Schedule.spaced("1 millis"))),
      Stream.take(6),
      Stream.tap((n) => Console.log(n))
    )
    
    Effect.runPromise(Stream.runDrain(stream))
    // Output each millisecond from the first stream, the rest streams are interrupted
    // 0
    // 1
    // 2
    // 3
    // 4
    // 5
  • #3410 e9d0310 Thanks @mikearnaldi! - Avoid automatic propagation of finalizer concurrency, closes #3440

  • #3410 6bf28f7 Thanks @tim-smart! - add Context.getOrElse api, for gettings a Tag's value with a fallback

Patch Changes

Don't miss a new effect release

NewReleases is sending notifications on new releases.