Skip to content

Commit

Permalink
Simplify and extend
Browse files Browse the repository at this point in the history
  • Loading branch information
treeowl committed Jun 5, 2018
1 parent 9a57483 commit 53365ce
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Control/Parallel/Strategies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,17 @@ withStrategy = flip using
-- | Compose two strategies sequentially.
-- This is the analogue to function composition on strategies.
--
-- > strat2 `dot` strat1 == strat2 . withStrategy strat1
--
-- 'dot' is associative:
--
-- > (strat1 `dot` strat2) `dot` strat3 == strat1 `dot` (strat2 `dot` strat3)
-- > strat `dot` r0 == strat
-- > rpar `dot` rseq == rpar
-- > rseq `dot` rpar == rseq
-- > r0 `dot` rpar == r0
-- > r0 `dot` rseq == r0
--
-- > strat2 `dot` strat1 == strat2 . withStrategy strat1
-- 'r0', 'rseq', and 'rpar' are all one-sided identities of 'dot':
--
-- > strat `dot` r0 == strat
-- > strat `dot` rseq == strat
-- > strat `dot` rpar == strat
--
-- Furthermore, if @strat@ only forces and sparks computations (that is, it
-- doesn't actually change any values), then
Expand All @@ -312,8 +315,7 @@ withStrategy = flip using
--
-- In particular,
--
-- > rpar `dot` rpar == rpar
-- > rseq `dot` rseq == rseq
-- > rdeepseq `dot` rdeepseq == rdeepseq
--
dot :: Strategy a -> Strategy a -> Strategy a
strat2 `dot` strat1 = strat2 . runEval . strat1
Expand Down

0 comments on commit 53365ce

Please sign in to comment.