@@ -1,3 +1,4 @@
1+{-# LANGUAGE BangPatterns #-}
1import Debug.Trace
2import Debug.Trace
2import Control.Monad
3import Control.Monad
3import Data.List
4import Data.List
@@ -33,15 +34,15 @@ paranoid = foldr go [] . T.lines
35read2 :: Num a => T.Lexer a -> T.Text -> a
36read2 :: Num a => T.Lexer a -> T.Text -> a
36−read2 reader = go
37+read2 reader = go 0
39 | T.null t = 0
40 | T.null t = 0
40 | otherwise = case reader t of
41 | otherwise = case reader t of
41 Left err -> error err
42 Left err -> error err
42 Right (n,t') -> case T.uncons t' of
43 Right (n,t') -> case T.uncons t' of
43 Nothing -> n
44 Nothing -> n
44− Just (_,t'') -> go t''
45+ Just (_,t'') -> go (n+i) t''
47 args <- getArgs
48 args <- getArgs