@@ -478,7 +478,7 @@ postscan (Fold stepL initialL extractL) (Fold stepR initialR extractR) =
478-- See also: 'Streamly.Prelude.mapM_'
478-- See also: 'Streamly.Prelude.mapM_'
480-- @since 0.7.0
480-- @since 0.7.0
481−{-# INLINABLE drainBy #-}
481+{-# INLINE drainBy #-}
482drainBy :: Monad m => (a -> m b) -> Fold m a ()
482drainBy :: Monad m => (a -> m b) -> Fold m a ()
483drainBy f = lmapM f drain
483drainBy f = lmapM f drain
@@ -487,7 +487,7 @@ drainBy f = lmapM f drain
487-- > last = fmap getLast $ Fold.foldMap (Last . Just)
487-- > last = fmap getLast $ Fold.foldMap (Last . Just)
489-- @since 0.7.0
489-- @since 0.7.0
490−{-# INLINABLE last #-}
490+{-# INLINE last #-}
491last :: Monad m => Fold m a (Maybe a)
491last :: Monad m => Fold m a (Maybe a)
492last = foldl1' (\_ x -> x)
492last = foldl1' (\_ x -> x)
@@ -612,7 +612,7 @@ minimum = foldl1' min
612-- stream.
612-- stream.
614-- @since 0.7.0
614-- @since 0.7.0
615−{-# INLINABLE mean #-}
615+{-# INLINE mean #-}
616mean :: (Monad m, Fractional a) => Fold m a a
616mean :: (Monad m, Fractional a) => Fold m a a
617mean = fmap done $ foldl' step begin
617mean = fmap done $ foldl' step begin
@@ -630,7 +630,7 @@ mean = fmap done $ foldl' step begin
630-- the input stream.
630-- the input stream.
632-- @since 0.7.0
632-- @since 0.7.0
633−{-# INLINABLE variance #-}
633+{-# INLINE variance #-}
634variance :: (Monad m, Fractional a) => Fold m a a
634variance :: (Monad m, Fractional a) => Fold m a a
635variance = fmap done $ foldl' step begin
635variance = fmap done $ foldl' step begin
@@ -653,7 +653,7 @@ variance = fmap done $ foldl' step begin
653-- elements in the input stream.
653-- elements in the input stream.
655-- @since 0.7.0
655-- @since 0.7.0
656−{-# INLINABLE stdDev #-}
656+{-# INLINE stdDev #-}
657stdDev :: (Monad m, Floating a) => Fold m a a
657stdDev :: (Monad m, Floating a) => Fold m a a
658stdDev = sqrt <$> variance
658stdDev = sqrt <$> variance
@@ -669,7 +669,7 @@ stdDev = sqrt <$> variance
669-- See https://en.wikipedia.org/wiki/Rolling_hash
669-- See https://en.wikipedia.org/wiki/Rolling_hash
671-- @since 0.8.0
671-- @since 0.8.0
672−{-# INLINABLE rollingHashWithSalt #-}
672+{-# INLINE rollingHashWithSalt #-}
673rollingHashWithSalt :: (Monad m, Enum a) => Int64 -> Fold m a Int64
673rollingHashWithSalt :: (Monad m, Enum a) => Int64 -> Fold m a Int64
674rollingHashWithSalt = foldl' step
674rollingHashWithSalt = foldl' step
@@ -689,7 +689,7 @@ defaultSalt = -2578643520546668380
689-- > rollingHash = Fold.rollingHashWithSalt defaultSalt
689-- > rollingHash = Fold.rollingHashWithSalt defaultSalt
691-- @since 0.8.0
691-- @since 0.8.0
692−{-# INLINABLE rollingHash #-}
692+{-# INLINE rollingHash #-}
693rollingHash :: (Monad m, Enum a) => Fold m a Int64
693rollingHash :: (Monad m, Enum a) => Fold m a Int64
694rollingHash = rollingHashWithSalt defaultSalt
694rollingHash = rollingHashWithSalt defaultSalt
@@ -699,7 +699,7 @@ rollingHash = rollingHashWithSalt defaultSalt
699-- > rollingHashFirstN = Fold.take n Fold.rollingHash
699-- > rollingHashFirstN = Fold.take n Fold.rollingHash
701-- /Pre-release/
701-- /Pre-release/
702−{-# INLINABLE rollingHashFirstN #-}
702+{-# INLINE rollingHashFirstN #-}
703rollingHashFirstN :: (Monad m, Enum a) => Int -> Fold m a Int64
703rollingHashFirstN :: (Monad m, Enum a) => Int -> Fold m a Int64
704rollingHashFirstN n = take n rollingHash
704rollingHashFirstN n = take n rollingHash
@@ -749,7 +749,7 @@ mconcat = sconcat mempty
749-- Sum {getSum = 55}
749-- Sum {getSum = 55}
751-- @since 0.7.0
751-- @since 0.7.0
752−{-# INLINABLE foldMap #-}
752+{-# INLINE foldMap #-}
753foldMap :: (Monad m, Monoid b
753foldMap :: (Monad m, Monoid b
754#if !MIN_VERSION_base(4,11,0)
754#if !MIN_VERSION_base(4,11,0)
755 , Semigroup b
755 , Semigroup b
@@ -767,7 +767,7 @@ foldMap f = lmap f mconcat
767-- Sum {getSum = 55}
767-- Sum {getSum = 55}
769-- @since 0.7.0
769-- @since 0.7.0
770−{-# INLINABLE foldMapM #-}
770+{-# INLINE foldMapM #-}
771foldMapM :: (Monad m, Monoid b) => (a -> m b) -> Fold m a b
771foldMapM :: (Monad m, Monoid b) => (a -> m b) -> Fold m a b
772foldMapM act = foldlM' step (pure mempty)
772foldMapM act = foldlM' step (pure mempty)
@@ -795,7 +795,7 @@ foldMapM act = foldlM' step (pure mempty)
795-- @since 0.8.0
795-- @since 0.8.0
797-- xn : ... : x2 : x1 : []
797-- xn : ... : x2 : x1 : []
798−{-# INLINABLE toListRev #-}
798+{-# INLINE toListRev #-}
799toListRev :: Monad m => Fold m a [a]
799toListRev :: Monad m => Fold m a [a]
800toListRev = foldl' (flip (:)) []
800toListRev = foldl' (flip (:)) []
@@ -820,7 +820,7 @@ drainN n = take n drain
820-- | Like 'index', except with a more general 'Integral' argument
820-- | Like 'index', except with a more general 'Integral' argument
822-- /Pre-release/
822-- /Pre-release/
823−{-# INLINABLE genericIndex #-}
823+{-# INLINE genericIndex #-}
824genericIndex :: (Integral i, Monad m) => i -> Fold m a (Maybe a)
824genericIndex :: (Integral i, Monad m) => i -> Fold m a (Maybe a)
825genericIndex i = mkFold step (Partial 0) (const Nothing)
825genericIndex i = mkFold step (Partial 0) (const Nothing)
@@ -836,21 +836,21 @@ genericIndex i = mkFold step (Partial 0) (const Nothing)
836-- See also: 'Streamly.Prelude.!!'
836-- See also: 'Streamly.Prelude.!!'
838-- @since 0.7.0
838-- @since 0.7.0
839−{-# INLINABLE index #-}
839+{-# INLINE index #-}
840index :: Monad m => Int -> Fold m a (Maybe a)
840index :: Monad m => Int -> Fold m a (Maybe a)
841index = genericIndex
841index = genericIndex
843-- | Extract the first element of the stream, if any.
843-- | Extract the first element of the stream, if any.
845-- @since 0.7.0
845-- @since 0.7.0
846−{-# INLINABLE head #-}
846+{-# INLINE head #-}
847head :: Monad m => Fold m a (Maybe a)
847head :: Monad m => Fold m a (Maybe a)
848head = mkFold_ (const (Done . Just)) (Partial Nothing)
848head = mkFold_ (const (Done . Just)) (Partial Nothing)
850-- | Returns the first element that satisfies the given predicate.
850-- | Returns the first element that satisfies the given predicate.
852-- @since 0.7.0
852-- @since 0.7.0
853−{-# INLINABLE find #-}
853+{-# INLINE find #-}
854find :: Monad m => (a -> Bool) -> Fold m a (Maybe a)
854find :: Monad m => (a -> Bool) -> Fold m a (Maybe a)
855find predicate = mkFold step (Partial ()) (const Nothing)
855find predicate = mkFold step (Partial ()) (const Nothing)
@@ -867,7 +867,7 @@ find predicate = mkFold step (Partial ()) (const Nothing)
867-- > lookup = snd <$> Fold.find ((==) . fst)
867-- > lookup = snd <$> Fold.find ((==) . fst)
869-- @since 0.7.0
869-- @since 0.7.0
870−{-# INLINABLE lookup #-}
870+{-# INLINE lookup #-}
871lookup :: (Eq a, Monad m) => a -> Fold m (a,b) (Maybe b)
871lookup :: (Eq a, Monad m) => a -> Fold m (a,b) (Maybe b)
872lookup a0 = mkFold step (Partial ()) (const Nothing)
872lookup a0 = mkFold step (Partial ()) (const Nothing)
@@ -881,7 +881,7 @@ lookup a0 = mkFold step (Partial ()) (const Nothing)
881-- | Returns the first index that satisfies the given predicate.
881-- | Returns the first index that satisfies the given predicate.
883-- @since 0.7.0
883-- @since 0.7.0
884−{-# INLINABLE findIndex #-}
884+{-# INLINE findIndex #-}
885findIndex :: Monad m => (a -> Bool) -> Fold m a (Maybe Int)
885findIndex :: Monad m => (a -> Bool) -> Fold m a (Maybe Int)
886findIndex predicate = mkFold step (Partial 0) (const Nothing)
886findIndex predicate = mkFold step (Partial 0) (const Nothing)
@@ -897,7 +897,7 @@ findIndex predicate = mkFold step (Partial 0) (const Nothing)
897-- > elemIndex a = Fold.findIndex (== a)
897-- > elemIndex a = Fold.findIndex (== a)
899-- @since 0.7.0
899-- @since 0.7.0
900−{-# INLINABLE elemIndex #-}
900+{-# INLINE elemIndex #-}
901elemIndex :: (Eq a, Monad m) => a -> Fold m a (Maybe Int)
901elemIndex :: (Eq a, Monad m) => a -> Fold m a (Maybe Int)
902elemIndex a = findIndex (a ==)
902elemIndex a = findIndex (a ==)
@@ -910,7 +910,7 @@ elemIndex a = findIndex (a ==)
910-- > null = fmap isJust Fold.head
910-- > null = fmap isJust Fold.head
912-- @since 0.7.0
912-- @since 0.7.0
913−{-# INLINABLE null #-}
913+{-# INLINE null #-}
914null :: Monad m => Fold m a Bool
914null :: Monad m => Fold m a Bool
915null = mkFold (\() _ -> Done False) (Partial ()) (const True)
915null = mkFold (\() _ -> Done False) (Partial ()) (const True)
@@ -940,7 +940,7 @@ any predicate = mkFold_ step initial
940-- > elem a = Fold.any (== a)
940-- > elem a = Fold.any (== a)
942-- @since 0.7.0
942-- @since 0.7.0
943−{-# INLINABLE elem #-}
943+{-# INLINE elem #-}
944elem :: (Eq a, Monad m) => a -> Fold m a Bool
944elem :: (Eq a, Monad m) => a -> Fold m a Bool
945elem a = any (a ==)
945elem a = any (a ==)
@@ -952,7 +952,7 @@ elem a = any (a ==)
952-- > all p = Fold.lmap p Fold.and
952-- > all p = Fold.lmap p Fold.and
954-- @since 0.7.0
954-- @since 0.7.0
955−{-# INLINABLE all #-}
955+{-# INLINE all #-}
956all :: Monad m => (a -> Bool) -> Fold m a Bool
956all :: Monad m => (a -> Bool) -> Fold m a Bool
957all predicate = mkFold_ step initial
957all predicate = mkFold_ step initial
@@ -970,7 +970,7 @@ all predicate = mkFold_ step initial
970-- > notElem a = Fold.all (/= a)
970-- > notElem a = Fold.all (/= a)
972-- @since 0.7.0
972-- @since 0.7.0
973−{-# INLINABLE notElem #-}
973+{-# INLINE notElem #-}
974notElem :: (Eq a, Monad m) => a -> Fold m a Bool
974notElem :: (Eq a, Monad m) => a -> Fold m a Bool
975notElem a = all (a /=)
975notElem a = all (a /=)
@@ -1782,6 +1782,6 @@ toStream = fmap SerialT toStreamK
1782-- /Pre-release/
1782-- /Pre-release/
1784-- xn : ... : x2 : x1 : []
1784-- xn : ... : x2 : x1 : []
1785−{-# INLINABLE toStreamRev #-}
1785+{-# INLINE toStreamRev #-}
1786toStreamRev :: Monad m => Fold m a (SerialT n a)
1786toStreamRev :: Monad m => Fold m a (SerialT n a)
1787toStreamRev = fmap SerialT toStreamKRev
1787toStreamRev = fmap SerialT toStreamKRev