@@ -30,9 +30,7 @@ module Streamly.Internal.Data.Stream.StreamD.Transform
31 -- * Folding
31 -- * Folding
37 -- * Scanning By 'Fold'
35 -- * Scanning By 'Fold'
38 , postscanOnce -- XXX rename to postscan
36 , postscanOnce -- XXX rename to postscan
@@ -123,14 +121,12 @@ where
123#include "inline.hs"
121#include "inline.hs"
125import Control.Monad (void)
123import Control.Monad (void)
126−import Control.Monad.Trans.Class (MonadTrans(lift))
127import Data.Maybe (fromJust, isJust)
124import Data.Maybe (fromJust, isJust)
128import Fusion.Plugin.Types (Fuse(..))
125import Fusion.Plugin.Types (Fuse(..))
129−import GHC.Types (SPEC(..))
131import Streamly.Internal.Data.Fold.Type (Fold(..))
127import Streamly.Internal.Data.Fold.Type (Fold(..))
132import Streamly.Internal.Data.Pipe.Type (Pipe(..), PipeState(..))
128import Streamly.Internal.Data.Pipe.Type (Pipe(..), PipeState(..))
133−import Streamly.Internal.Data.SVar.Type (defState, adaptState)
129+import Streamly.Internal.Data.SVar.Type (adaptState)
135import qualified Streamly.Internal.Data.Fold.Type as FL
131import qualified Streamly.Internal.Data.Fold.Type as FL
136import qualified Streamly.Internal.Data.Pipe.Type as Pipe
132import qualified Streamly.Internal.Data.Pipe.Type as Pipe
@@ -175,18 +171,6 @@ transform (Pipe pstep1 pstep2 pstate) (Stream step state) =
175-- Transformation Folds
171-- Transformation Folds
176------------------------------------------------------------------------------
172------------------------------------------------------------------------------
178−{-# INLINE_NORMAL foldlT #-}
179−foldlT :: (Monad m, Monad (s m), MonadTrans s)
180− => (s m b -> a -> s m b) -> s m b -> Stream m a -> s m b
181−foldlT fstep begin (Stream step state) = go SPEC begin state
184− r <- lift $ step defState st
186− Yield x s -> go SPEC (fstep acc x) s
187− Skip s -> go SPEC acc s
190-- Note, this is going to have horrible performance, because of the nature of
174-- Note, this is going to have horrible performance, because of the nature of
191-- the stream type (i.e. direct stream vs CPS). Its only for reference, it is
175-- the stream type (i.e. direct stream vs CPS). Its only for reference, it is
192-- likely be practically unusable.
176-- likely be practically unusable.