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 18, 2018
1 parent 9a57483 commit 1e27bea
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions Control/Parallel/Strategies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -296,24 +296,22 @@ withStrategy = flip using
-- | Compose two strategies sequentially.
-- This is the analogue to function composition on strategies.
--
-- > (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
--
-- Furthermore, if @strat@ only forces and sparks computations (that is, it
-- doesn't actually change any values), then
-- 'dot' is associative:
--
-- > strat `dot` strat == strat
-- > (strat1 `dot` strat2) `dot` strat3 == strat1 `dot` (strat2 `dot` strat3)
--
-- In particular,
-- 'r0', 'rseq', and 'rpar' are all one-sided identities of 'dot':
--
-- > rpar `dot` rpar == rpar
-- > rseq `dot` rseq == rseq
-- > strat `dot` r0 == strat
-- > strat `dot` rseq == strat
-- > strat `dot` rpar == strat
--
-- Furthermore, since strategies should only force and sparks computations
-- (that is, they don't actually change any values),
--
-- > strat `dot` strat == strat
--
dot :: Strategy a -> Strategy a -> Strategy a
strat2 `dot` strat1 = strat2 . runEval . strat1
Expand Down

0 comments on commit 1e27bea

Please sign in to comment.