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