@@ -6,10 +6,11 @@ import Control.Monad.Eff (Eff)
66import Control.Monad.Eff.Console (CONSOLE , log )
77
88import Data.Foldable (foldMap , foldl )
9- import Data.List (List (Nil, Cons), (..), length , range , foldM , unzip , zip , zipWithA , zipWith , intersectBy , intersect , (\\), deleteBy , delete , unionBy , union , nubBy , nub , groupBy , group' , group , span , dropWhile , drop , takeWhile , take , sortBy , sort , catMaybes , mapMaybe , filterM , filter , concat , concatMap , reverse , alterAt , modifyAt , updateAt , deleteAt , insertAt , findLastIndex , findIndex , elemLastIndex , elemIndex , (!!), uncons , init , tail , last , head , insertBy , insert , snoc , null , replicateM , replicate , singleton , fromFoldable , transpose , mapWithIndex , (:))
9+ import Data.List (List (Nil, Cons), (..), length , range , foldM , unzip , zip , zipWithA , zipWith , intersectBy , intersect , (\\), deleteBy , delete , unionBy , union , nubBy , nub , groupBy , group' , group , span , dropWhile , drop , takeWhile , take , sortBy , sort , catMaybes , mapMaybe , filterM , filter , concat , concatMap , reverse , alterAt , modifyAt , updateAt , deleteAt , insertAt , findLastIndex , findIndex , elemLastIndex , elemIndex , (!!), uncons , init , tail , last , head , insertBy , insert , snoc , null , singleton , fromFoldable , transpose , mapWithIndex , (:))
1010import Data.Maybe (Maybe (..), isNothing , fromJust )
1111import Data.Monoid.Additive (Additive (Additive))
1212import Data.Tuple (Tuple (..))
13+ import Data.Unfoldable (replicate , replicateA , unfoldr )
1314
1415import Partial.Unsafe (unsafePartial )
1516
@@ -34,11 +35,11 @@ testList = do
3435 assert $ replicate 0 " foo" == l []
3536 assert $ replicate (-1 ) " foo" == l []
3637
37- log " replicateM should perform the monadic action the correct number of times"
38- assert $ replicateM 3 (Just 1 ) == Just (l [1 , 1 , 1 ])
39- assert $ replicateM 1 (Just 1 ) == Just (l [1 ])
40- assert $ replicateM 0 (Just 1 ) == Just (l [] )
41- assert $ replicateM (-1 ) (Just 1 ) == Just (l [] )
38+ log " replicatA should perform the monadic action the correct number of times"
39+ assert $ replicateA 3 (Just 1 ) == Just (l [1 , 1 , 1 ])
40+ assert $ replicateA 1 (Just 1 ) == Just (l [1 ])
41+ assert $ replicateA 0 (Just 1 ) == Just (l [] )
42+ assert $ replicateA (-1 ) (Just 1 ) == Just (l [] )
4243
4344 -- some
4445 -- many
@@ -295,11 +296,11 @@ testList = do
295296 log " foldMap should be left-to-right"
296297 assert $ foldMap show (range 1 5 ) == " 12345"
297298
298- log " unfoldr should be stack-safe"
299- void $ pure $ length $ Data.Unfoldable . replicate 100000 1
299+ log " unfoldable replicate should be stack-safe"
300+ void $ pure $ length $ replicate 100000 1
300301
301302 log " unfoldr should maintain order"
302- assert $ (1 ..5 ) == Data.Unfoldable . unfoldr step 1
303+ assert $ (1 ..5 ) == unfoldr step 1
303304
304305 -- log "can find the first 10 primes using lazy lists"
305306 -- let eratos :: L.List Number -> L.List Number
0 commit comments