effect@3.0.0
Major Changes
- #2207
2fb7d9cThanks @github-actions! - Release Effect 3.0 ๐
Minor Changes
-
#2207
1b5f0c7Thanks @github-actions! - close FiberHandle/FiberSet/FiberMap when it is releasedWhen they are closed, fibers can no longer be added to them.
-
#2207
d50a652Thanks @github-actions! - add preregisteredWords option to frequency metric key typeYou 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
9a3bd47Thanks @github-actions! - Bump TypeScript min requirement to version 5.4 -
#2207
be9d025Thanks @github-actions! - add unique identifier to Tracer.ParentSpan tag -
#2529
78b767cThanks @fubhy! - RenamedReadonlyArrayandReadonlyRecordmodules for better discoverability. -
#2207
5c2b561Thanks @github-actions! - The signatures of theHaltStrategy.matchStreamHaltStrategy.matchfunctions have been changed to the generally accepted ones -
#2207
a18f594Thanks @github-actions! - support variadic arguments in Effect.logThis makes Effect.log more similar to console.log:
Effect.log("hello", { foo: "bar" }, Cause.fail("error"));
-
#2207
2f96d93Thanks @github-actions! - Fix ConfigError_tag, with the previous implementation catching theConfigErrorwithEffect.catchTagwould showAnd,Or, etc. -
#2207
5a2314bThanks @github-actions! - replace use ofunitterminology withvoidFor all the data types.
Effect.unit; // => Effect.void Stream.unit; // => Stream.void // etc
-
#2207
271b79fThanks @github-actions! - Either: fixgetEquivalenceparameter order fromEither.getEquivalence(left, right)toEither.getEquivalence({ left, right }) -
#2207
53d1c2aThanks @github-actions! - use LazyArg for Effect.if branchesInstead 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
e7e1bbeThanks @github-actions! - Replaced customNoInfertype with the nativeNoInfertype from TypeScript 5.4 -
#2207
10c169eThanks @github-actions! -Cache<Key, Error, Value>has been changed toCache<Key, Value, Error = never>.
ScopedCache<Key, Error, Value>has been changed toScopedCache<Key, Value, Error = never>.
Lookup<Key, Environment, Error, Value>has been changed toLookup<Key, Value, Error = never, Environment = never>
Patch Changes
-
#2104
1499974Thanks @IMax153! - don't run resolver if there are no incomplete requests -
#2207
1b5f0c7Thanks @github-actions! - add FiberMap.has/unsafeHas api -
#2104
1499974Thanks @IMax153! - add String casing transformation apissnakeToCamelsnakeToPascalsnakeToKebabcamelToSnakepascalToSnakekebabToSnake
-
#2207
1b5f0c7Thanks @github-actions! - add FiberHandle module, for holding a reference to a running fiberimport { 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
6424181Thanks @patroza! - change return type of Fiber.joinAll to return an array