From 1e27bea493803cd55e13b140aa9a1815fd218ac2 Mon Sep 17 00:00:00 2001 From: David Feuer Date: Tue, 5 Jun 2018 10:28:20 -0400 Subject: [PATCH] Simplify and extend --- Control/Parallel/Strategies.hs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Control/Parallel/Strategies.hs b/Control/Parallel/Strategies.hs index ed565cc..914fdba 100644 --- a/Control/Parallel/Strategies.hs +++ b/Control/Parallel/Strategies.hs @@ -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