@@ -6,7 +6,7 @@ import Control.Lazy (defer)
66import Data.FoldableWithIndex (foldMapWithIndex , foldlWithIndex , foldrWithIndex )
77import Data.FunctorWithIndex (mapWithIndex )
88import Data.Lazy as Z
9- import Data.List.Lazy (List , Pattern (..), alterAt , catMaybes , concat , concatMap , cons , delete , deleteAt , deleteBy , drop , dropWhile , elemIndex , elemLastIndex , filter , filterM , findIndex , findLastIndex , foldM , foldMap , foldl , foldr , foldrLazy , fromFoldable , group , groupBy , head , init , insert , insertAt , insertBy , intersect , intersectBy , iterate , last , length , mapMaybe , modifyAt , nil , nub , nubBy , null , partition , range , repeat , replicate , replicateM , reverse , scanrLazy , singleton , slice , snoc , span , stripPrefix , tail , take , takeWhile , transpose , uncons , union , unionBy , unzip , updateAt , zip , zipWith , zipWithA , (!!), (..), (:), (\\))
9+ import Data.List.Lazy (List , Pattern (..), alterAt , catMaybes , concat , concatMap , cons , delete , deleteAt , deleteBy , drop , dropWhile , elemIndex , elemLastIndex , filter , filterM , findIndex , findLastIndex , foldM , foldMap , foldl , foldr , foldrLazy , fromFoldable , group , groupBy , head , init , insert , insertAt , insertBy , intersect , intersectBy , iterate , last , length , mapMaybe , modifyAt , nil , nub , nubBy , null , partition , range , repeat , replicate , replicateM , reverse , scanlLazy , singleton , slice , snoc , span , stripPrefix , tail , take , takeWhile , transpose , uncons , union , unionBy , unzip , updateAt , zip , zipWith , zipWithA , (!!), (..), (:), (\\))
1010import Data.List.Lazy.NonEmpty as NEL
1111import Data.Maybe (Maybe (..), isNothing , fromJust )
1212import Data.Monoid.Additive (Additive (..))
@@ -394,11 +394,14 @@ testListLazy = do
394394 infs' = foldrLazy cons nil infs
395395 in take 1000 infs == take 1000 infs'
396396
397- log " scanrLazy should work ok on infinite lists"
397+ log " scanlLazy should work ok on infinite lists"
398398 assert let infs = iterate (_ + 1 ) 1
399- infs' = scanrLazy (\i _ -> i) 0 infs
399+ infs' = scanlLazy (\_ i -> i) 0 infs
400400 in take 1000 infs == take 1000 infs'
401401
402+ log " scanlLazy folds to the left"
403+ assert $ scanlLazy (+) 5 (1 ..4 ) == l [6 , 8 , 11 , 15 ]
404+
402405 log " can find the first 10 primes using lazy lists"
403406 let eratos :: List Int -> List Int
404407 eratos xs = defer \_ ->
0 commit comments