Skip to content

Effect

Version 4.0.0-beta.80

Patch Changes

  • #2205 d944330 Thanks @lloydrichards! - add support for merging external events into Prompt.custom render loops via an optional events dequeue and receive handler.

    The prompt races user input against events from the dequeue, allowing background events to trigger re-renders without waiting for a keypress:

    const eventQueue = yield * Queue.make<number>();
    const prompt = Prompt.custom(
    { count: 0 },
    Queue.asDequeue(eventQueue), // <-- provide the event queue as a dequeue to the prompt
    {
    render: (state) => Effect.succeed(`Count: ${state.count}`),
    process: (input, state) =>
    Effect.succeed(
    Match.value(input).pipe(
    // handle user input
    Match.tag("Input", () => Action.Submit({ value: state.count })),
    // handle external events from the queue
    Match.tag("Event", (input) =>
    Action.NextFrame({ state: { count: state.count + input.value } }),
    ),
    Match.exhaustive,
    ),
    ),
    clear: () => Effect.succeed(""),
    },
    );
  • #2369 f48659f Thanks @gcanti! - Round fractional durations symmetrically when normalizing to nanoseconds.

  • #2373 7652aaa Thanks @StarpTech! - Stream.fromReadableStream: swallow the reader.cancel() rejection in the finalizer. Cancelling the reader of an already-errored ReadableStream rejects with the stored error, which turned the typed onError failure into a defect.

  • #2371 98630b7 Thanks @gcanti! - Emit Schema.ObjectKeyword as an object-or-array JSON Schema union.

  • #2376 90ae23c Thanks @fubhy! - Add Graph.successors and Graph.predecessors, deprecate Graph.neighborsDirected, and fix graph algorithm edge cases around reversal, undirected edge queries, shortest-path weight validation, topological sort initials, and strongly connected components.