github Effect-TS/effect effect@2.3.6

latest releases: @effect/vitest@0.10.5, @effect/sql-sqlite-wasm@0.13.0, @effect/sql-sqlite-react-native@0.16.0...
7 months ago

Patch Changes

  • #2145 b1163b2 Thanks @tim-smart! - add RequestResolver.aroundRequests api

    This can be used to run side effects that introspect the requests being
    executed.

    Example:

    import { Effect, Request, RequestResolver } from "effect";
    
    interface GetUserById extends Request.Request<unknown> {
      readonly id: number;
    }
    
    declare const resolver: RequestResolver.RequestResolver<GetUserById>;
    
    RequestResolver.aroundRequests(
      resolver,
      (requests) => Effect.log(`got ${requests.length} requests`),
      (requests, _) => Effect.log(`finised running ${requests.length} requests`),
    );
  • #2148 b46b869 Thanks @riordanpawley! - Flipped scheduleForked types to match new <A, E, R> signature

  • #2139 de1b226 Thanks @mikearnaldi! - Introduce FiberId.Single, make FiberId.None behave like FiberId.Runtime, relax FiberRefs to use Single instead of Runtime.

    This change is a precursor to enable easier APIs to modify the Runtime when patching FiberRefs.

  • #2137 a663390 Thanks @mikearnaldi! - Expose Random Tag and functions to use a specific random service implementation

  • #2143 ff88f80 Thanks @mikearnaldi! - Fix Cause.pretty when toString is invalid

    import { Cause } from "effect";
    
    console.log(Cause.pretty(Cause.fail([{ toString: "" }])));

    The code above used to throw now it prints:

    Error: [{"toString":""}]
  • #2080 11be07b Thanks @KhraksMamtsov! - Add functional analogue of satisfies operator.
    This is a convenient operator to use in the pipe chain to localize type errors closer to their source.

    import { satisfies } from "effect/Function";
    
    const test1 = satisfies<number>()(5 as const);
    // ^? const test: 5
    
    // @ts-expect-error
    const test2 = satisfies<string>()(5);
    // ^? Argument of type 'number' is not assignable to parameter of type 'string'
  • #2147 c568645 Thanks @tim-smart! - generate a random span id for the built-in tracer

    This ensures the same span id isn't used between application runs.

  • #2144 88835e5 Thanks @mikearnaldi! - Fix withRandom and withClock types

  • #2138 b415577 Thanks @mikearnaldi! - Fix internals of TestAnnotationsMap making it respect equality

  • #2149 ff8046f Thanks @tim-smart! - add Runtime.updateFiberRefs/setFiberRef/deleteFiberRef

    This change allows you to update fiber ref values inside a Runtime object.

    Example:

    import { Effect, FiberRef, Runtime } from "effect";
    
    const ref = FiberRef.unsafeMake(0);
    
    const updatedRuntime = Runtime.defaultRuntime.pipe(
      Runtime.setFiberRef(ref, 1),
    );
    
    // returns 1
    const result = Runtime.runSync(updatedRuntime)(FiberRef.get(ref));

Don't miss a new effect release

NewReleases is sending notifications on new releases.