github Effect-TS/effect effect@3.1.0

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

Minor Changes

  • #2543 c3c12c6 Thanks @github-actions! - add SortedMap.lastOption & partition apis

  • #2543 ba64ea6 Thanks @github-actions! - add Types.DeepMutable, an alternative to Types.Mutable that makes all properties recursively mutable

  • #2543 b5de2d2 Thanks @github-actions! - add Effect.annotateLogsScoped

    This api allows you to annotate logs until the Scope has been closed.

    import { Effect } from "effect";
    
    Effect.gen(function* () {
      yield* Effect.log("no annotations");
      yield* Effect.annotateLogsScoped({ foo: "bar" });
      yield* Effect.log("annotated with foo=bar");
    }).pipe(Effect.scoped, Effect.andThen(Effect.log("no annotations again")));
  • #2543 a1c7ab8 Thanks @github-actions! - added Stream.fromEventListener, and BrowserStream.{fromEventListenerWindow, fromEventListenerDocument} for constructing a stream from addEventListener

  • #2543 a023f28 Thanks @github-actions! - add kind property to Tracer.Span

    This can be used to specify what kind of service created the span.

  • #2543 1c9454d Thanks @github-actions! - add Effect.timeoutOption

    Returns an effect that will return None if the effect times out, otherwise it
    will return Some of the produced value.

    import { Effect } from "effect";
    
    // will return `None` after 500 millis
    Effect.succeed("hello").pipe(
      Effect.delay(1000),
      Effect.timeoutOption("500 millis"),
    );
  • #2543 92d56db Thanks @github-actions! - add $is & $match helpers to Data.TaggedEnum constructors

    import { Data } from "effect";
    
    type HttpError = Data.TaggedEnum<{
      NotFound: {};
      InternalServerError: { reason: string };
    }>;
    const { $is, $match, InternalServerError, NotFound } =
      Data.taggedEnum<HttpError>();
    
    // create a matcher
    const matcher = $match({
      NotFound: () => 0,
      InternalServerError: () => 1,
    });
    
    // true
    $is("NotFound")(NotFound());
    
    // false
    $is("NotFound")(InternalServerError({ reason: "fail" }));

Don't miss a new effect release

NewReleases is sending notifications on new releases.