Fix matchResponseMapWithRequests to handle prompt response.#505
Fix matchResponseMapWithRequests to handle prompt response.#505bglgwyng wants to merge 6 commits into
matchResponseMapWithRequests to handle prompt response.#505Conversation
ryantrinkle
left a comment
There was a problem hiding this comment.
Looks like a good patch, but I am slightly concerned about this being prompt. What if someone does something like this?
b <- requesting a
c <- requesting b
Will that create a cycle? It seems like it would. It would be great to add a test for this
Even if that does in fact create a cycle, we could still have something prompt here as an option
|
I tried to add test for new |
|
I think we can refactor this code with |
The example you gave hangs, not even printing 'causality loop detected. |
|
Closing this based on the conversation above. Please reopen if you're still interested in this. |
|
Reopening because I'd like to investigate this some more since I'm interested in increased laziness. |
|
I used to need this behavior when I was trying to structure my entire Reflex project as a set of request-response relationships. That led me to implement something like this: newtype Counter t = Counter (Behavior t Int)
data CounterReq a where
Inc :: CounterReq ()
Dec :: CounterReq ()
This required CounterReq to be handled synchronously, within the same time frame. |
This minimal example demonstrates a request/response interaction. When a request is made, the corresponding response is generated immediately, as seen in the
eResponsedefinition. However, the current implementation ofmatchResponseMapWithRequestsdoesn't correctly handle prompt responses, resulting in "Got Response!" not being printed fromeX. This fix ensures that prompt responses are handled correctly, allowing "Got Response!" to be printed as expected.