github Effect-TS/effect effect@2.4.3

latest releases: @effect/typeclass@0.29.14, @effect/vitest@0.13.14, @effect/sql-sqlite-wasm@0.20.5...
8 months ago

Patch Changes

  • #2211 20e63fb Thanks @tim-smart! - add ManagedRuntime module, to make incremental adoption easier

    You can use a ManagedRuntime to run Effect's that can use the
    dependencies from the given Layer. For example:

    import { Console, Effect, Layer, ManagedRuntime } from "effect";
    
    class Notifications extends Effect.Tag("Notifications")<
      Notifications,
      { readonly notify: (message: string) => Effect.Effect<void> }
    >() {
      static Live = Layer.succeed(this, {
        notify: (message) => Console.log(message),
      });
    }
    
    async function main() {
      const runtime = ManagedRuntime.make(Notifications.Live);
      await runtime.runPromise(Notifications.notify("Hello, world!"));
      await runtime.dispose();
    }
    
    main();
  • #2211 20e63fb Thanks @tim-smart! - add Layer.toRuntimeWithMemoMap api

    Similar to Layer.toRuntime, but allows you to share a Layer.MemoMap between
    layer builds.

    By sharing the MemoMap, layers are shared between each build - ensuring layers
    are only built once between multiple calls to Layer.toRuntimeWithMemoMap.

Don't miss a new effect release

NewReleases is sending notifications on new releases.