Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.

Commit 19c5080

Browse files
authored
Merge pull request #358 from edsko/edsko/avoid-run
Avoid unnecessary use of `run`
2 parents 5feea58 + 589109f commit 19c5080

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Test/StateMachine/Sequential.hs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module Test.StateMachine.Sequential
3535
, ShouldShrink(..)
3636
, initValidateEnv
3737
, runCommands
38+
, runCommands'
3839
, getChanContents
3940
, Check(..)
4041
, executeCommands
@@ -325,9 +326,16 @@ runCommands :: (Show (cmd Concrete), Show (resp Concrete))
325326
=> StateMachine model cmd m resp
326327
-> Commands cmd resp
327328
-> PropertyM m (History cmd resp, model Concrete, Reason)
328-
runCommands sm@StateMachine { initModel, cleanup } = run . go
329-
where
330-
go cmds = mask $ \restore -> do
329+
runCommands sm cmds = run $ runCommands' sm cmds
330+
331+
runCommands' :: (Show (cmd Concrete), Show (resp Concrete))
332+
=> (Rank2.Traversable cmd, Rank2.Foldable resp)
333+
=> (MonadMask m, MonadIO m)
334+
=> StateMachine model cmd m resp
335+
-> Commands cmd resp
336+
-> m (History cmd resp, model Concrete, Reason)
337+
runCommands' sm@StateMachine { initModel, cleanup } cmds =
338+
mask $ \restore -> do
331339
hchan <- restore newTChanIO
332340
(reason, (_, _, _, model)) <- restore
333341
(runStateT

0 commit comments

Comments
 (0)