Patch Changes
-
#2211
20e63fb
Thanks @tim-smart! - add ManagedRuntime module, to make incremental adoption easierYou 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 apiSimilar 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.