@@ -121,55 +121,6 @@ length :: Stream Char -> Int
121121length = S.lengthI
122122{-# INLINE[0] length #-}
123123
124−-- | /O(n)/ Returns the number of characters in a text.
125−length64 :: Stream Char -> Int64
126−length64 (Stream next s0 _len) = loop_length 0 s0
127− where
128− loop_length z s = case next s of
129− Done -> z
130− Skip s' -> loop_length z s'
131− Yield _ s' -> let !z' = z + 1
132− in loop_length z' s'
133−{-# INLINE[0] length64 #-}
134−
135−-- ----------------------------------------------------------------------------
136−-- * Stream transformations
137−
138−-- | /O(n)/ 'map' @f @xs is the Stream Char obtained by applying @f@ to each element of
139−-- @xs@.
140−map :: (Char -> Char) -> Stream Char -> Stream Char
141−map f (Stream next0 s0 len) = Stream next s0 len
142− where
143− {-# INLINE next #-}
144− next !s = case next0 s of
145− Done -> Done
146− Skip s' -> Skip s'
147− Yield x s' -> Yield (f x) s'
148−{-# INLINE [0] map #-}
149−
150−{-#
151− RULES "STREAM map/map fusion" forall f g s.
152− map f (map g s) = map (\x -> f (g x)) s
153− #-}
154−
155−-- | /O(n)/ Take a character and place it between each of the
156−-- characters of a 'Stream Char'.
157−intersperse :: Char -> Stream Char -> Stream Char
158−intersperse c (Stream next0 s0 len) = Stream next (s0 :!: Nothing :!: S1) len
159− where
160− {-# INLINE next #-}
161− next (s :!: Nothing :!: S1) = case next0 s of
162− Done -> Done
163− Skip s' -> Skip (s' :!: Nothing :!: S1)
164− Yield x s' -> Skip (s' :!: Just x :!: S1)
165− next (s :!: Just x :!: S1) = Yield x (s :!: Nothing :!: S2)
166− next (s :!: Nothing :!: S2) = case next0 s of
167− Done -> Done
168− Skip s' -> Skip (s' :!: Nothing :!: S2)
169− Yield x s' -> Yield c (s' :!: Just x :!: S1)
170− next _ = internalError "intersperse"
171−{-# INLINE [0] intersperse #-}
172−
173124-- | /O(n)/ Reverse the characters of a string.
174125reverse :: Stream Char -> Text
175126reverse (Stream next s len0)