Commits

Bryan O'Sullivan committed a3f09f5

Make sure we use the result

Comments (0)

Files changed (1)

tests/benchmarks/ReadNumbers.hs

+{-# LANGUAGE BangPatterns #-}
 import Debug.Trace
 import Control.Monad
 import Data.List
                     else xs
     
 read2 :: Num a => T.Lexer a -> T.Text -> a
-read2 reader = go
+read2 reader = go 0
  where
-   go t
+   go !i t
     | T.null t = 0
     | otherwise = case reader t of
                     Left err -> error err
                     Right (n,t') -> case T.uncons t' of
                                       Nothing -> n
-                                      Just (_,t'') -> go t''
+                                      Just (_,t'') -> go (n+i) t''
 
 main = do
   args <- getArgs