applyUpdate :: Update -> BufferM ()
applyUpdate update = do
  ro    <- checkRO
  valid <- queryBuffer (isValidUpdate update)
  when (not ro && valid) $ do
    forgetPreferCol
    let reversed = reverseUpdateI update
    modifyBuffer (applyUpdateI update)

    isTransacPresent <- use updateTransactionInFlightA
    if isTransacPresent
    then updateTransactionAccumA %= (reversed:)
    else undosA %= addChangeU (AtomicChange reversed)

    tell [update]
   -- otherwise, just ignore.

-- | Revert all the pending updates; don't touch the point.
applyUpdate :: Update -> BufferM ()
applyUpdate update = do
  ro    <- checkRO
  valid <- queryBuffer (isValidUpdate update)
  when (not ro && valid) $ do
    forgetPreferCol
    let reversed = reverseUpdateI update
    modifyBuffer (applyUpdateI update)

    isTransacPresent <- use updateTransactionInFlightA
    if isTransacPresent
    then updateTransactionAccumA %= (reversed:)
    else undosA %= addChangeU (AtomicChange reversed)

    tell [update]
   -- otherwise, just ignore.

-- | Revert all the pending updates; don't touch the point.
applyUpdate update = do
  ro    <- checkRO
  valid <- queryBuffer (isValidUpdate update)
  when (not ro && valid) $ do
    forgetPreferCol
    let reversed = reverseUpdateI update
    modifyBuffer (applyUpdateI update)

    isTransacPresent <- use updateTransactionInFlightA
    if isTransacPresent
    then updateTransactionAccumA %= (reversed:)
    else undosA %= addChangeU (AtomicChange reversed)

    tell [update]
   -- otherwise, just ignore.

-- | Revert all the pending updates; don't touch the point.