@@ -158,9 +158,11 @@ nil :: Monad m => Stream m a
158158nil = Stream (\_ _ -> return Stop) ()
159159
160160-- | Can fuse but has O(n^2) complexity.
161+{-# INLINE_NORMAL cons #-}
161162cons :: Monad m => a -> Stream m a -> Stream m a
162163cons x (Stream step state) = Stream step1 Nothing
163164 where
165+ {-# INLINE_LATE step1 #-}
164166 step1 _ Nothing = return $ Yield x (Just state)
165167 step1 gst (Just st) = do
166168 r <- step (rstState gst) st
@@ -497,7 +499,7 @@ postscanlM' fstep begin (Stream step state) =
497499 y `seq` return (Yield y (s, y))
498500 Stop -> return Stop
499501
500−{-# INLINE scanlM' #-}
502+{-# INLINE_LATE scanlM' #-}
501503scanlM' :: Monad m => (b -> a -> m b) -> b -> Stream m a -> Stream m b
502504scanlM' fstep begin s = begin `seq` (begin `cons` postscanlM' fstep begin s)
503505