Make sure we use the result
--HG--
extra : convert_revision : 7cb0be85f3000f994b3a9268a55b78602903619b
commiteb52d5900542a989232570d97e05ef6cccd91a2f
authorBryan O'Sullivan <bos@serpentine.com>
dateSat 9 Oct 2010, 00:25 (16 years ago)
parent6e84333
tests/benchmarks/ReadNumbers.hs+4−3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE BangPatterns #-}
12import Debug.Trace
23import Control.Monad
34import Data.List
@@ -33,15 +34,15 @@ paranoid = foldr go [] . T.lines
3334 else xs
3435
3536read2 :: Num a => T.Lexer a -> T.Text -> a
36−read2 reader = go
37+read2 reader = go 0
3738 where
38− go t
39+ go !i t
3940 | T.null t = 0
4041 | otherwise = case reader t of
4142 Left err -> error err
4243 Right (n,t') -> case T.uncons t' of
4344 Nothing -> n
44− Just (_,t'') -> go t''
45+ Just (_,t'') -> go (n+i) t''
4546
4647main = do
4748 args <- getArgs