diff --git a/quasar/src/Quasar/Observable/List.hs b/quasar/src/Quasar/Observable/List.hs index f883ee9..7dbc758 100644 --- a/quasar/src/Quasar/Observable/List.hs +++ b/quasar/src/Quasar/Observable/List.hs @@ -505,7 +505,7 @@ newVarIO x = liftIO $ ObservableListVar <$> newSubjectIO x -- | Apply a list of `AbsoluteListDeltaOperation`s as a single change. applyOperationsVar :: (MonadSTMc NoRetry '[] m) => ObservableListVar v -> [ListOperation v] -> m () applyOperationsVar (ObservableListVar var) ops = - updateSimpleSubject var \list -> + modifySubject var \list -> operationsToUpdate (fromIntegral (Seq.length list)) ops applyDeltaVar :: (MonadSTMc NoRetry '[] m) => ObservableListVar v -> ListDelta v -> m () diff --git a/quasar/src/Quasar/Observable/Subject.hs b/quasar/src/Quasar/Observable/Subject.hs index 9244803..d238bbb 100644 --- a/quasar/src/Quasar/Observable/Subject.hs +++ b/quasar/src/Quasar/Observable/Subject.hs @@ -14,7 +14,7 @@ module Quasar.Observable.Subject ( readSubject, readSubjectIO, changeSubject, - updateSimpleSubject, + modifySubject, subjectHasObservers, ) where @@ -102,13 +102,13 @@ changeSubject (Subject var registry) change = liftSTMc do writeTVar var newState callCallbacks registry evaluatedChange -updateSimpleSubject :: +modifySubject :: forall c v m. (MonadSTMc NoRetry '[] m, ObservableContainer c v) => Subject NoLoad '[] c v -> (c v -> Maybe (ObservableUpdate c v)) -> m () -updateSimpleSubject (Subject var registry) mkUpdate = liftSTMc do +modifySubject (Subject var registry) mkUpdate = liftSTMc do state <- readTVar var let (ObserverStateLive (ObservableResultTrivial content)) = state forM_ (observableUpdateToChange (ObserverContextLive (toDeltaContext @c content)) (mkUpdate content)) \containerChange -> do