Skip to content

Commit 1c31386

Browse files
committed
Add doNothing
1 parent 8c31c52 commit 1c31386

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Control/Concurrent/Execute.hs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,15 @@ runActions' ExecuteState {..} = loop
124124
errs <- readTVar esExceptions
125125
if null errs || esKeepGoing
126126
then inner
127-
else pure $ pure ()
127+
else doNothing
128+
128129
withActions :: ([Action] -> STM (IO ())) -> STM (IO ())
129130
withActions inner = do
130-
as <- readTVar esActions
131-
if null as
132-
then pure $ pure ()
133-
else inner as
131+
actions <- readTVar esActions
132+
if null actions
133+
then doNothing
134+
else inner actions
135+
134136
loop :: IO ()
135137
loop = join $ atomically $ breakOnErrs $ withActions $ \as ->
136138
case break (Set.null . actionDeps) as of
@@ -140,7 +142,7 @@ runActions' ExecuteState {..} = loop
140142
then do
141143
unless esKeepGoing $
142144
modifyTVar esExceptions (toException InconsistentDependenciesBug:)
143-
pure $ pure ()
145+
doNothing
144146
else retry
145147
(xs, action:ys) -> do
146148
inAction <- readTVar esInAction
@@ -174,3 +176,7 @@ runActions' ExecuteState {..} = loop
174176
-- action.
175177
downstreamActions :: ActionId -> [Action] -> [Action]
176178
downstreamActions aid = filter (\a -> aid `Set.member` actionDeps a)
179+
180+
-- | @IO ()@ lifted into 'STM'.
181+
doNothing :: STM (IO ())
182+
doNothing = pure $ pure ()

0 commit comments

Comments
 (0)