@@ -62,7 +62,7 @@ source n = UF.enumerateFromToIntegral n
63{-# INLINE drainGeneration #-}
63{-# INLINE drainGeneration #-}
64drainGeneration :: Monad m => Unfold m a b -> a -> m ()
64drainGeneration :: Monad m => Unfold m a b -> a -> m ()
65−drainGeneration unf seed = UF.fold unf FL.drain seed
65+drainGeneration unf seed = UF.fold FL.drain unf seed
67{-# INLINE drainTransformation #-}
67{-# INLINE drainTransformation #-}
68drainTransformation ::
68drainTransformation ::
@@ -409,7 +409,7 @@ toNullAp value start =
409 let end = start + nthRoot 2 value
409 let end = start + nthRoot 2 value
410 s = source end
410 s = source end
411 -- in UF.fold ((+) <$> s <*> s) FL.drain start
411 -- in UF.fold ((+) <$> s <*> s) FL.drain start
412− in UF.fold ((+) `fmap` s `UF.apply` s) FL.drain start
412+ in UF.fold FL.drain ((+) `fmap` s `UF.apply` s) start
414{-# INLINE _apDiscardFst #-}
414{-# INLINE _apDiscardFst #-}
415_apDiscardFst :: Int -> Int -> m ()
415_apDiscardFst :: Int -> Int -> m ()
@@ -451,7 +451,7 @@ toNull value start =
451 u = src `UF.bind` \x ->
451 u = src `UF.bind` \x ->
452 src `UF.bind` \y ->
452 src `UF.bind` \y ->
453 UF.yield (x + y)
453 UF.yield (x + y)
454− in UF.fold u FL.drain start
454+ in UF.fold FL.drain u start
457{-# INLINE toNull3 #-}
457{-# INLINE toNull3 #-}
@@ -469,7 +469,7 @@ toNull3 value start =
469 u = src `UF.bind` \x ->
469 u = src `UF.bind` \x ->
470 src `UF.bind` \y ->
470 src `UF.bind` \y ->
471 UF.yield (x + y)
471 UF.yield (x + y)
472− in UF.fold u FL.drain start
472+ in UF.fold FL.drain u start
474{-# INLINE toList #-}
474{-# INLINE toList #-}
475toList :: Monad m => Int -> Int -> m [Int]
475toList :: Monad m => Int -> Int -> m [Int]
@@ -485,7 +485,7 @@ toList value start = do
485 u = src `UF.bind` \x ->
485 u = src `UF.bind` \x ->
486 src `UF.bind` \y ->
486 src `UF.bind` \y ->
487 UF.yield (x + y)
487 UF.yield (x + y)
488− in UF.fold u FL.toList start
488+ in UF.fold FL.toList u start
490{-# INLINE toListSome #-}
490{-# INLINE toListSome #-}
491toListSome :: Monad m => Int -> Int -> m [Int]
491toListSome :: Monad m => Int -> Int -> m [Int]
@@ -501,7 +501,7 @@ toListSome value start = do
501 u = src `UF.bind` \x ->
501 u = src `UF.bind` \x ->
502 src `UF.bind` \y ->
502 src `UF.bind` \y ->
503 UF.yield (x + y)
503 UF.yield (x + y)
504− in UF.fold (UF.take 1000 u) FL.toList start
504+ in UF.fold FL.toList (UF.take 1000 u) start
506{-# INLINE filterAllOut #-}
506{-# INLINE filterAllOut #-}
507filterAllOut :: Monad m => Int -> Int -> m ()
507filterAllOut :: Monad m => Int -> Int -> m ()
@@ -519,7 +519,7 @@ filterAllOut value start = do
519 in if s < 0
519 in if s < 0
520 then UF.yield s
520 then UF.yield s
521 else UF.nilM (return . const ())
521 else UF.nilM (return . const ())
522− in UF.fold u FL.drain start
522+ in UF.fold FL.drain u start
524{-# INLINE filterAllIn #-}
524{-# INLINE filterAllIn #-}
525filterAllIn :: Monad m => Int -> Int -> m ()
525filterAllIn :: Monad m => Int -> Int -> m ()
@@ -537,7 +537,7 @@ filterAllIn value start = do
537 in if s > 0
537 in if s > 0
538 then UF.yield s
538 then UF.yield s
539 else UF.nilM (return . const ())
539 else UF.nilM (return . const ())
540− in UF.fold u FL.drain start
540+ in UF.fold FL.drain u start
542{-# INLINE filterSome #-}
542{-# INLINE filterSome #-}
543filterSome :: Monad m => Int -> Int -> m ()
543filterSome :: Monad m => Int -> Int -> m ()
@@ -555,7 +555,7 @@ filterSome value start = do
555 in if s > 1100000
555 in if s > 1100000
556 then UF.yield s
556 then UF.yield s
557 else UF.nilM (return . const ())
557 else UF.nilM (return . const ())
558− in UF.fold u FL.drain start
558+ in UF.fold FL.drain u start
560{-# INLINE breakAfterSome #-}
560{-# INLINE breakAfterSome #-}
561breakAfterSome :: Int -> Int -> IO ()
561breakAfterSome :: Int -> Int -> IO ()
@@ -574,7 +574,7 @@ breakAfterSome value start =
574 then error "break"
574 then error "break"
575 else UF.yield s
575 else UF.yield s
577− (_ :: Either ErrorCall ()) <- try $ UF.fold u FL.drain start
577+ (_ :: Either ErrorCall ()) <- try $ UF.fold FL.drain u start
578 return ()
578 return ()
580-------------------------------------------------------------------------------
580-------------------------------------------------------------------------------
@@ -590,9 +590,7 @@ concatCount linearCount =
590concat :: Monad m => Int -> Int -> m ()
590concat :: Monad m => Int -> Int -> m ()
591concat linearCount start = do
591concat linearCount start = do
592 let end = start + concatCount linearCount
592 let end = start + concatCount linearCount
594− (UF.many (source end) (source end))
595− FL.drain start
593+ UF.fold FL.drain (UF.many (source end) (source end)) start
597-------------------------------------------------------------------------------
595-------------------------------------------------------------------------------
598-- Benchmarks
596-- Benchmarks