@@ -141,6 +141,7 @@ module Data.Text.Lazy
143 -- * Zipping and unzipping
143 -- * Zipping and unzipping
144 , zipWith
145 , zipWith
146 -- -* Ordered text
147 -- -* Ordered text
@@ -148,9 +149,8 @@ module Data.Text.Lazy
150import Prelude (Char, Bool(..), Int, Maybe(..), String,
151import Prelude (Char, Bool(..), Int, Maybe(..), String,
151− Eq(..), Ord(..), (++),
152− Read(..), Show(..),
152+ Eq(..), Ord(..), Read(..), Show(..),
153− (&&), (+), (-), (.),
153+ (&&), (+), (-), (.), ($), (++),
154 flip, fromIntegral, not, otherwise)
154 flip, fromIntegral, not, otherwise)
155import qualified Prelude as P
155import qualified Prelude as P
156import Data.Int (Int64)
156import Data.Int (Int64)
@@ -850,6 +850,14 @@ count :: Char -> Text -> Int64
850count c t = S.count c (stream t)
850count c t = S.count c (stream t)
851{-# INLINE count #-}
851{-# INLINE count #-}
853+-- | /O(n)/ 'zip' takes two 'Text's and returns a list of
854+-- corresponding pairs of bytes. If one input 'Text' is short,
855+-- excess elements of the longer 'Text' are discarded. This is
856+-- equivalent to a pair of 'unpack' operations.
857+zip :: Text -> Text -> [(Char,Char)]
858+zip a b = S.unstreamList $ S.zipWith (,) (stream a) (stream b)
859+{-# INLINE [0] zip #-}
853-- | /O(n)/ 'zipWith' generalises 'zip' by zipping with the function
861-- | /O(n)/ 'zipWith' generalises 'zip' by zipping with the function
854-- given as the first argument, instead of a tupling function.
862-- given as the first argument, instead of a tupling function.
855zipWith :: (Char -> Char -> Char) -> Text -> Text -> Text
863zipWith :: (Char -> Char -> Char) -> Text -> Text -> Text