@@ -158,9 +158,11 @@ nil :: Monad m => Stream m a
158nil = Stream (\_ _ -> return Stop) ()
158nil = Stream (\_ _ -> return Stop) ()
160-- | Can fuse but has O(n^2) complexity.
160-- | Can fuse but has O(n^2) complexity.
161+{-# INLINE_NORMAL cons #-}
161cons :: Monad m => a -> Stream m a -> Stream m a
162cons :: Monad m => a -> Stream m a -> Stream m a
162cons x (Stream step state) = Stream step1 Nothing
163cons x (Stream step state) = Stream step1 Nothing
165+ {-# INLINE_LATE step1 #-}
164 step1 _ Nothing = return $ Yield x (Just state)
166 step1 _ Nothing = return $ Yield x (Just state)
165 step1 gst (Just st) = do
167 step1 gst (Just st) = do
166 r <- step (rstState gst) st
168 r <- step (rstState gst) st
@@ -497,7 +499,7 @@ postscanlM' fstep begin (Stream step state) =
497 y `seq` return (Yield y (s, y))
499 y `seq` return (Yield y (s, y))
498 Stop -> return Stop
500 Stop -> return Stop
500−{-# INLINE scanlM' #-}
502+{-# INLINE_LATE scanlM' #-}
501scanlM' :: Monad m => (b -> a -> m b) -> b -> Stream m a -> Stream m b
503scanlM' :: Monad m => (b -> a -> m b) -> b -> Stream m a -> Stream m b
502scanlM' fstep begin s = begin `seq` (begin `cons` postscanlM' fstep begin s)
504scanlM' fstep begin s = begin `seq` (begin `cons` postscanlM' fstep begin s)