Patch Changes
-
#2503
41c8102
Thanks @gcanti! - Centralize error messages for bugs -
#2493
776ef2b
Thanks @gcanti! - add aRegExp
module topackages/effect
, closes #2488 -
#2499
217147e
Thanks @tim-smart! - ensure FIFO ordering when a Deferred is resolved -
#2502
90776ec
Thanks @tim-smart! - make tracing spans cheaper to construct -
#2472
8709856
Thanks @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
Actor
from the experimentalMachine
module
- A
-
#2500
232c353
Thanks @tim-smart! - simplify scope internals -
#2507
0ca835c
Thanks @gcanti! - ensure correct value is passed to mapping function inmapAccum
loop, closes #2506 -
#2472
8709856
Thanks @tim-smart! - add Readable module / traitReadable
is 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
e983740
Thanks @jessekelly881! - added {Readable, Subscribable}.unwrap -
#2494
e3e0924
Thanks @thewilkybarkid! - AddDuration.divide
andDuration.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));