Remove unexpected laziness from lazy count
--HG--
extra : convert_revision : 7c23d9d1541b3c61aaed5d27e75162e694d51ba6
commit2b507cd66aa77ad3e24464b3a51a99a5d7425142
authorBryan O'Sullivan <bos@serpentine.com>
dateFri 13 Aug 2010, 22:35 (16 years ago)
parent859d445
Data/Text/Lazy.hs+3−3
@@ -1246,9 +1246,9 @@ index t n = S.index (stream t) n
12461246count :: Text -> Text -> Int64
12471247count pat src
12481248 | null pat = emptyError "count"
1249− | otherwise = len (indices pat src)
1250− where len [] = 0
1251− len (_:xs) = 1 + len xs
1249+ | otherwise = go 0 (indices pat src)
1250+ where go !n [] = n
1251+ go !n (_:xs) = go (n+1) xs
12521252{-# INLINE [1] count #-}
12531253
12541254{-# RULES