Merge commit '36c66dd290d3ce6eb1ccd310d0c658d4a32bb8eb' as 'repos/effect'

This commit is contained in:
-Puter
2026-07-19 03:25:10 +05:30
parent dd1071cc10
commit 2daf979036
2214 changed files with 673090 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
---
"effect": patch
---
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:
```ts
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("")
}
)
```