@@ -6,10 +6,11 @@ import Control.Monad.Eff (Eff)
6
6
import Control.Monad.Eff.Console (CONSOLE , log )
7
7
8
8
import 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 , (:))
10
10
import Data.Maybe (Maybe (..), isNothing , fromJust )
11
11
import Data.Monoid.Additive (Additive (Additive))
12
12
import Data.Tuple (Tuple (..))
13
+ import Data.Unfoldable (replicate , replicateA , unfoldr )
13
14
14
15
import Partial.Unsafe (unsafePartial )
15
16
@@ -34,11 +35,11 @@ testList = do
34
35
assert $ replicate 0 " foo" == l []
35
36
assert $ replicate (-1 ) " foo" == l []
36
37
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 [] )
42
43
43
44
-- some
44
45
-- many
@@ -295,11 +296,11 @@ testList = do
295
296
log " foldMap should be left-to-right"
296
297
assert $ foldMap show (range 1 5 ) == " 12345"
297
298
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
300
301
301
302
log " unfoldr should maintain order"
302
- assert $ (1 ..5 ) == Data.Unfoldable . unfoldr step 1
303
+ assert $ (1 ..5 ) == unfoldr step 1
303
304
304
305
-- log "can find the first 10 primes using lazy lists"
305
306
-- let eratos :: L.List Number -> L.List Number
0 commit comments