github Effect-TS/effect effect@2.4.3

latest releases: @effect/sql-sqlite-bun@0.12.7, @effect/typeclass@0.27.3, @effect/sql-sqlite-react-native@0.14.6...
6 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.