@@ -60,6 +60,7 @@ module Data.Text.Fusion
62 -- * Construction
62 -- * Construction
64 , unfoldrN
65 , unfoldrN
@@ -84,10 +85,9 @@ module Data.Text.Fusion
87−import Prelude hiding
88+import Prelude (Bool(..), Char, Either(..), Eq(..), Maybe(..), Monad(..),
88− (map, tail, head, foldr, filter, concat, last, init, null, length, foldl,
89+ Num(..), Ord(..), String, ($), (++), (.), (&&), error,
89− foldl1, foldr1, concatMap, any, all, maximum, minimum, take, drop,
90+ fromIntegral, fst, otherwise, snd)
90− takeWhile, dropWhile, elem, zipWith, reverse)
91import Data.Char (ord)
91import Data.Char (ord)
92import Control.Monad (liftM2)
92import Control.Monad (liftM2)
93import Control.Monad.ST (runST, ST)
93import Control.Monad.ST (runST, ST)
@@ -543,6 +543,14 @@ minimum (Stream next0 s0 _len) = loop0_minimum s0
543-- -----------------------------------------------------------------------------
543-- -----------------------------------------------------------------------------
544-- ** Generating and unfolding streams
544-- ** Generating and unfolding streams
546+replicate :: Int -> Char -> Stream Char
547+replicate n c = Stream next 0 n
550+ next i | i >= n = Done
551+ | otherwise = Yield c (i + 1)
552+{-# INLINE [0] replicate #-}
546-- | /O(n)/, where @n@ is the length of the result. The unfoldr function
554-- | /O(n)/, where @n@ is the length of the result. The unfoldr function
547-- is analogous to the List 'unfoldr'. unfoldr builds a stream
555-- is analogous to the List 'unfoldr'. unfoldr builds a stream
548-- from a seed value. The function takes the element and returns
556-- from a seed value. The function takes the element and returns