@@ -593,37 +593,29 @@ parListNth n strat = evalListNth n (rparWith strat)
593593-- | Divides a list into chunks, and applies the strategy
594594-- @'evalList' strat@ to each chunk in parallel.
595595--
596- -- It is expected that this function will be replaced by a more
597- -- generic clustering infrastructure in the future.
598- --
599596-- If the chunk size is 1 or less, 'parListChunk' is equivalent to
600597-- 'parList'
601598--
599+ -- This function may be replaced by a more
600+ -- generic clustering infrastructure in the future.
602601parListChunk :: Int -> Strategy a -> Strategy [a ]
603- parListChunk = parListChunk'
604-
605- parListChunk' :: Int -> (a -> Eval b ) -> [a ] -> Eval [b ]
606- parListChunk' n strat
607- | n <= 1 = traverse strat
608-
609- -- parListChunk n strat xs =
610- -- concat `fmap` 'parList' ('evalList' strat) (chunk n xs)
611- -- but we avoid building intermediate lists.
612- parListChunk' n0 strat = go n0
602+ parListChunk n strat
603+ | n <= 1 = parList strat
604+ | otherwise = go
613605 where
614- go ! _n [] = pure []
615- go n as = mdo
606+ go [] = pure []
607+ go as = mdo
616608 -- Calculate the first chunk in parallel, passing it the result
617609 -- of calculating the rest
618610 bs <- rpar $ runEval $ evalChunk strat more n as
619611
620612 -- Calculate the rest
621- more <- go n (drop n as)
613+ more <- go (drop n as)
622614 return bs
623615
624616-- | @evalChunk strat end n as@ uses @strat@ to evaluate the first @n@
625617-- elements of @as@ (ignoring the rest) and appends @end@ to the result.
626- evalChunk :: ( a -> Eval b ) -> [ b ] -> Int -> [ a ] -> Eval [ b ]
618+ evalChunk :: Strategy a -> [ a ] -> Int -> Strategy [ a ]
627619evalChunk strat = \ end ->
628620 let
629621 go ! _n [] = pure end
0 commit comments