on master help sign in
Minor cleanups
d1c7fadBryan O'Sullivan
Data/Text/Lazy.hs+6−6
@@ -179,13 +179,13 @@ instance IsString Text where
179--
179--
180-- This function is subject to array fusion.
180-- This function is subject to array fusion.
181pack :: String -> Text
181pack :: String -> Text
182−pack = unstream . S.streamList
182+pack s = unstream (S.streamList s)
183{-# INLINE [1] pack #-}
183{-# INLINE [1] pack #-}
184
184
185-- | /O(n)/ Convert a 'Text' into a 'String'.
185-- | /O(n)/ Convert a 'Text' into a 'String'.
186-- Subject to array fusion.
186-- Subject to array fusion.
187unpack :: Text -> String
187unpack :: Text -> String
188−unpack = S.unstreamList . stream
188+unpack t = S.unstreamList (stream t)
189{-# INLINE [1] unpack #-}
189{-# INLINE [1] unpack #-}
190
190
191singleton :: Char -> Text
191singleton :: Char -> Text
@@ -193,9 +193,9 @@ singleton c = Chunk (T.singleton c) Empty
193{-# INLINE [1] singleton #-}
193{-# INLINE [1] singleton #-}
194
194
195{-# RULES
195{-# RULES
196−"TEXT singleton -> fused" [~1] forall c.
196+"LAZY TEXT singleton -> fused" [~1] forall c.
197 singleton c = unstream (S.singleton c)
197 singleton c = unstream (S.singleton c)
198−"TEXT singleton -> unfused" [1] forall c.
198+"LAZY TEXT singleton -> unfused" [1] forall c.
199 unstream (S.singleton c) = singleton c
199 unstream (S.singleton c) = singleton c
200 #-}
200 #-}
201
201
@@ -216,9 +216,9 @@ append xs ys = foldrChunks Chunk ys xs
216{-# INLINE append #-}
216{-# INLINE append #-}
217
217
218{-# RULES
218{-# RULES
219−"TEXT append -> fused" [~1] forall t1 t2.
219+"LAZY TEXT append -> fused" [~1] forall t1 t2.
220 append t1 t2 = unstream (S.append (stream t1) (stream t2))
220 append t1 t2 = unstream (S.append (stream t1) (stream t2))
221−"TEXT append -> unfused" [1] forall t1 t2.
221+"LAZY TEXT append -> unfused" [1] forall t1 t2.
222 unstream (S.append (stream t1) (stream t2)) = append t1 t2
222 unstream (S.append (stream t1) (stream t2)) = append t1 t2
223 #-}
223 #-}
224
224
Data/Text/Lazy/Fusion.hs+2−1
@@ -73,4 +73,5 @@ unstream :: Stream Char -> Text
73unstream = unstreamChunks defaultChunkSize
73unstream = unstreamChunks defaultChunkSize
74{-# INLINE [0] unstream #-}
74{-# INLINE [0] unstream #-}
75
75
76−{-# RULES "STREAM stream/unstream fusion" forall s. stream (unstream s) = s #-}
76+{-# RULES "LAZY STREAM stream/unstream fusion" forall s.
77+ stream (unstream s) = s #-}