effect@3.1.0
Minor Changes
-
#2543
c3c12c6Thanks @github-actions! - add SortedMap.lastOption & partition apis -
#2543
ba64ea6Thanks @github-actions! - addTypes.DeepMutable, an alternative toTypes.Mutablethat makes all properties recursively mutable -
#2543
b5de2d2Thanks @github-actions! - add Effect.annotateLogsScopedThis 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
a1c7ab8Thanks @github-actions! - added Stream.fromEventListener, and BrowserStream.{fromEventListenerWindow, fromEventListenerDocument} for constructing a stream from addEventListener -
#2543
a023f28Thanks @github-actions! - addkindproperty toTracer.SpanThis can be used to specify what kind of service created the span.
-
#2543
1c9454dThanks @github-actions! - add Effect.timeoutOptionReturns an effect that will return
Noneif the effect times out, otherwise it
will returnSomeof 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
92d56dbThanks @github-actions! - add $is & $match helpers to Data.TaggedEnum constructorsimport { 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" }));