Skip to content

Commit

Permalink
quasar: Rename updateSimpleSubject to modifySubject
Browse files Browse the repository at this point in the history
  • Loading branch information
queezle42 committed Dec 18, 2023
1 parent 491f30f commit 44654be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion quasar/src/Quasar/Observable/List.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
6 changes: 3 additions & 3 deletions quasar/src/Quasar/Observable/Subject.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Quasar.Observable.Subject (
readSubject,
readSubjectIO,
changeSubject,
updateSimpleSubject,
modifySubject,
subjectHasObservers,
) where

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 44654be

Please sign in to comment.