@@ -60,6 +60,10 @@ module Data.Text.Fusion
62 -- * Construction
62 -- * Construction
66+ -- ** Generation and unfolding
63 , replicate
67 , replicate
65 , unfoldrN
69 , unfoldrN
@@ -540,6 +544,18 @@ minimum (Stream next0 s0 _len) = loop0_minimum s0
540-- -----------------------------------------------------------------------------
544-- -----------------------------------------------------------------------------
541-- * Building streams
545-- * Building streams
547+scanl :: (Char -> Char -> Char) -> Char -> Stream Char -> Stream Char
548+scanl f z0 (Stream next0 s0 len) = Stream next (S1 :!: z0 :!: s0) (len+1)
551+ next (S1 :!: z :!: s) = Yield z (S2 :!: z :!: s)
552+ next (S2 :!: z :!: s) = case next0 s of
553+ Yield x s' -> let !x' = f z x
554+ in Yield x' (S2 :!: x' :!: s')
555+ Skip s' -> Skip (S2 :!: z :!: s')
557+{-# INLINE [0] scanl #-}
543-- -----------------------------------------------------------------------------
559-- -----------------------------------------------------------------------------
544-- ** Generating and unfolding streams
560-- ** Generating and unfolding streams