on master help sign in
Add streamList/unstreamList fusion rule

--HG-- extra : convert_revision : 69db9862a085ef75353ddbe91864971817e54814

commite9d08525f11f67125c00a9edd05322f8c9d640e0 authorBryan O'Sullivan <bos@serpentine.com> dateSun 8 Mar 2009, 05:59 (18 years ago) parentb846b5e
1 file changed+4−2
Data/Text/Fusion/Common.hs+4−2
Data/Text/Fusion/Common.hs+4−2
@@ -104,7 +104,7 @@ singleton c = Stream next False 1 -- HINT maybe too low
104104{-# INLINE singleton #-}
105105
106106streamList :: [a] -> Stream a
107−{-# INLINE streamList #-}
107+{-# INLINE [0] streamList #-}
108108streamList [] = empty
109109streamList s = Stream next s unknownLength
110110 where next [] = Done
@@ -112,13 +112,15 @@ streamList s = Stream next s unknownLength
112112 unknownLength = 8 -- random HINT
113113
114114unstreamList :: Stream a -> [a]
115−{-# INLINE unstreamList #-}
115+{-# INLINE [0] unstreamList #-}
116116unstreamList (Stream next s0 _len) = unfold s0
117117 where unfold !s = case next s of
118118 Done -> []
119119 Skip s' -> unfold s'
120120 Yield x s' -> x : unfold s'
121121
122+{-# RULES "STREAM streamList/unstreamList fusion" forall s. streamList (unstreamList s) = s #-}
123+
122124-- ----------------------------------------------------------------------------
123125-- * Basic stream functions
124126