Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we need mergeGPromptly also? #509

Open
bglgwyng opened this issue Sep 18, 2024 · 0 comments
Open

Do we need mergeGPromptly also? #509

bglgwyng opened this issue Sep 18, 2024 · 0 comments

Comments

@bglgwyng
Copy link

bglgwyng commented Sep 18, 2024

Just as we have both switchHold and switchHoldPromptly, I think we need mergeGPromptly over mergeG.

processRequestIntMap' ::
  forall t m req resp.
  (Reflex t, MonadFix m, MonadHold t m, Adjustable t m) =>
  Event t (IntMap (m (Event t (Some resp)))) ->
  Event t (RequesterData req) ->
  m (Event t (IntMap (Some req)), Event t (RequesterData resp))
processRequestIntMap' eOutResp' eReq = mdo
  (eInReq, eOutResp) <-
    matchResponseMapWithRequests
      encdecSome
      eReq
      eInResp

  let eInResp = pushAlways pure $ mergeIntMapIncremental iAdjusted
  iAdjusted <- holdIncremental initial ePatch
  (initial, ePatch) <-
    traverseIntMapWithKeyWithAdjust
      (\k v -> v)
      mempty
      ( ( ffor eInResp (fmap (const Nothing))
            <> (fmap Just <$> eOutResp')
        )
          `ffor` PatchIntMap
      )

  pure (eInReq, eOutResp)

I'm writing such a function and the usage of mergeIntMapIncremental creates a problem that the prompt response is not handled properly. I add delay 0 as a workaround to fix this issue for now. If we have such function mergeIntMapIncrementalPromptly, then it will work without the workaround.

It's related to #508 and #505

@bglgwyng bglgwyng changed the title Do we need mergePromptly also? Do we need mergeGPromptly also? Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant