github Effect-TS/effect effect@3.0.0

latest releases: @effect/typeclass@0.24.40, @effect/printer@0.33.40, @effect/printer-ansi@0.33.40...
2 months ago

Major Changes

Minor Changes

  • #2207 1b5f0c7 Thanks @github-actions! - close FiberHandle/FiberSet/FiberMap when it is released

    When they are closed, fibers can no longer be added to them.

  • #2207 d50a652 Thanks @github-actions! - add preregisteredWords option to frequency metric key type

    You can use this to register a list of words to pre-populate the value of the
    metric.

    import { Metric } from "effect";
    
    const counts = Metric.frequency("counts", {
      preregisteredWords: ["a", "b", "c"],
    }).register();
  • #2207 9a3bd47 Thanks @github-actions! - Bump TypeScript min requirement to version 5.4

  • #2207 be9d025 Thanks @github-actions! - add unique identifier to Tracer.ParentSpan tag

  • #2529 78b767c Thanks @fubhy! - Renamed ReadonlyArray and ReadonlyRecord modules for better discoverability.

  • #2207 5c2b561 Thanks @github-actions! - The signatures of the HaltStrategy.match StreamHaltStrategy.match functions have been changed to the generally accepted ones

  • #2207 a18f594 Thanks @github-actions! - support variadic arguments in Effect.log

    This makes Effect.log more similar to console.log:

    Effect.log("hello", { foo: "bar" }, Cause.fail("error"));
  • #2207 2f96d93 Thanks @github-actions! - Fix ConfigError _tag, with the previous implementation catching the ConfigError with Effect.catchTag would show And, Or, etc.

  • #2207 5a2314b Thanks @github-actions! - replace use of unit terminology with void

    For all the data types.

    Effect.unit; // => Effect.void
    Stream.unit; // => Stream.void
    
    // etc
  • #2207 271b79f Thanks @github-actions! - Either: fix getEquivalence parameter order from Either.getEquivalence(left, right) to Either.getEquivalence({ left, right })

  • #2207 53d1c2a Thanks @github-actions! - use LazyArg for Effect.if branches

    Instead of:

    Effect.if(true, {
      onTrue: Effect.succeed("true"),
      onFalse: Effect.succeed("false"),
    });

    You should now write:

    Effect.if(true, {
      onTrue: () => Effect.succeed("true"),
      onFalse: () => Effect.succeed("false"),
    });
  • #2207 e7e1bbe Thanks @github-actions! - Replaced custom NoInfer type with the native NoInfer type from TypeScript 5.4

  • #2207 10c169e Thanks @github-actions! - Cache<Key, Error, Value> has been changed to Cache<Key, Value, Error = never>.
    ScopedCache<Key, Error, Value> has been changed to ScopedCache<Key, Value, Error = never>.
    Lookup<Key, Environment, Error, Value> has been changed to Lookup<Key, Value, Error = never, Environment = never>

Patch Changes

  • #2104 1499974 Thanks @IMax153! - don't run resolver if there are no incomplete requests

  • #2207 1b5f0c7 Thanks @github-actions! - add FiberMap.has/unsafeHas api

  • #2104 1499974 Thanks @IMax153! - add String casing transformation apis

    • snakeToCamel
    • snakeToPascal
    • snakeToKebab
    • camelToSnake
    • pascalToSnake
    • kebabToSnake
  • #2207 1b5f0c7 Thanks @github-actions! - add FiberHandle module, for holding a reference to a running fiber

    import { Effect, FiberHandle } from "effect";
    
    Effect.gen(function* (_) {
      const handle = yield* _(FiberHandle.make());
    
      // run some effects
      yield* _(FiberHandle.run(handle, Effect.never));
      // this will interrupt the previous fiber
      yield* _(FiberHandle.run(handle, Effect.never));
      // this will not run, as a fiber is already running
      yield* _(FiberHandle.run(handle, Effect.never, { onlyIfMissing: true }));
    
      yield* _(Effect.sleep(1000));
    }).pipe(
      Effect.scoped, // The fiber will be interrupted when the scope is closed
    );
  • #2521 6424181 Thanks @patroza! - change return type of Fiber.joinAll to return an array

Don't miss a new effect release

NewReleases is sending notifications on new releases.