@@ -540,7 +540,10 @@ parTraversable strat = evalTraversable (rparWith strat)
540
540
-- Strategies for lists
541
541
542
542
-- | Evaluate each element of a list according to the given strategy.
543
- -- Equivalent to 'evalTraversable' at the list type.
543
+ -- Equivalent to 'evalTraversable' at the list type.
544
+ --
545
+ -- __Warning:__ This strategy evaluates the spine of the list
546
+ -- and thus does not work on infinite lists.
544
547
evalList :: Strategy a -> Strategy [a ]
545
548
evalList = evalTraversable
546
549
-- Alternative explicitly recursive definition:
@@ -550,14 +553,17 @@ evalList = evalTraversable
550
553
-- return (x':xs')
551
554
552
555
-- | Evaluate each element of a list in parallel according to given strategy.
553
- -- Equivalent to 'parTraversable' at the list type.
556
+ -- Equivalent to 'parTraversable' at the list type.
557
+ --
558
+ -- __Warning:__ This strategy evaluates the spine of the list
559
+ -- and thus does not work on infinite lists.
554
560
parList :: Strategy a -> Strategy [a ]
555
561
parList = parTraversable
556
562
-- Alternative definition via evalList:
557
563
-- parList strat = evalList (rparWith strat)
558
564
559
565
-- | @'evaListSplitAt' n stratPref stratSuff@ evaluates the prefix
560
- -- (of length @n@) of a list according to @stratPref@ and its the suffix
566
+ -- (of length @n@) of a list according to @stratPref@ and the suffix
561
567
-- according to @stratSuff@.
562
568
evalListSplitAt :: Int -> Strategy [a ] -> Strategy [a ] -> Strategy [a ]
563
569
evalListSplitAt n stratPref stratSuff xs
@@ -598,6 +604,9 @@ parListNth n strat = evalListNth n (rparWith strat)
598
604
--
599
605
-- This function may be replaced by a more
600
606
-- generic clustering infrastructure in the future.
607
+ --
608
+ -- __Warning:__ This strategy evaluates the spine of the list
609
+ -- and thus does not work on infinite lists.
601
610
parListChunk :: Int -> Strategy a -> Strategy [a ]
602
611
parListChunk n strat
603
612
| n <= 1 = parList strat
@@ -630,6 +639,8 @@ evalChunk strat = \end ->
630
639
--
631
640
-- > parMap strat f = withStrategy (parList strat) . map f
632
641
--
642
+ -- __Warning:__ This function evaluates the spine of the list
643
+ -- and thus does not work on infinite lists.
633
644
parMap :: Strategy b -> (a -> b ) -> [a ] -> [b ]
634
645
parMap strat f = (`using` parList strat) . map f
635
646
0 commit comments