github Effect-TS/effect effect@2.4.19

latest releases: @effect/sql-sqlite-bun@0.12.7, @effect/typeclass@0.27.3, @effect/sql-sqlite-react-native@0.14.6...
5 months ago

Patch Changes

  • #2503 41c8102 Thanks @gcanti! - Centralize error messages for bugs

  • #2493 776ef2b Thanks @gcanti! - add a RegExp module to packages/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 / module

    Subscribable 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 experimental Machine module
  • #2500 232c353 Thanks @tim-smart! - simplify scope internals

  • #2507 0ca835c Thanks @gcanti! - ensure correct value is passed to mapping function in mapAccum loop, closes #2506

  • #2472 8709856 Thanks @tim-smart! - add Readable module / trait

    Readable is a common interface for objects that can be read from using a get
    Effect.

    For example, Ref's implement Readable:

    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! - Add Duration.divide and Duration.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));

Don't miss a new effect release

NewReleases is sending notifications on new releases.