effect@2.4.19
Patch Changes
-
#2503
41c8102Thanks @gcanti! - Centralize error messages for bugs -
#2493
776ef2bThanks @gcanti! - add aRegExpmodule topackages/effect, closes #2488 -
#2499
217147eThanks @tim-smart! - ensure FIFO ordering when a Deferred is resolved -
#2502
90776ecThanks @tim-smart! - make tracing spans cheaper to construct -
#2472
8709856Thanks @tim-smart! - add Subscribable trait / moduleSubscribable represents a resource that has a current value and can be subscribed to for updates.
The following data types are subscribable:
- A
SubscriptionRef - An
Actorfrom the experimentalMachinemodule
- A
-
#2500
232c353Thanks @tim-smart! - simplify scope internals -
#2507
0ca835cThanks @gcanti! - ensure correct value is passed to mapping function inmapAccumloop, closes #2506 -
#2472
8709856Thanks @tim-smart! - add Readable module / traitReadableis a common interface for objects that can be read from using aget
Effect.For example,
Ref's implementReadable:import { Effect, Readable, Ref } from "effect"; import assert from "assert"; Effect.gen(function* (_) { const ref = yield* _(Ref.make(123)); assert(Readable.isReadable(ref)); const result = yield* _(ref.get); assert(result === 123); });
-
#2498
e983740Thanks @jessekelly881! - added {Readable, Subscribable}.unwrap -
#2494
e3e0924Thanks @thewilkybarkid! - AddDuration.divideandDuration.unsafeDivide.import { Duration, Option } from "effect"; import assert from "assert"; assert.deepStrictEqual( Duration.divide("10 seconds", 2), Option.some(Duration.decode("5 seconds")), ); assert.deepStrictEqual(Duration.divide("10 seconds", 0), Option.none()); assert.deepStrictEqual(Duration.divide("1 nano", 1.5), Option.none()); assert.deepStrictEqual( Duration.unsafeDivide("10 seconds", 2), Duration.decode("5 seconds"), ); assert.deepStrictEqual( Duration.unsafeDivide("10 seconds", 0), Duration.infinity, ); assert.throws(() => Duration.unsafeDivide("1 nano", 1.5));