on master help sign in
Constructed Product Return wins us another wee bit

--HG-- extra : convert_revision : 59f9a78e191152992a200acd4e7ca68e1cd2cf14

commit446eb32c7805b082ec70afd6c0762a0ee6a08f12 authorBryan O'Sullivan <bos@serpentine.com> dateSat 9 Oct 2010, 00:25 (16 years ago) parenteb52d59
1 file changed+4−2
Data/Text/Lex.hs+4−2
Data/Text/Lex.hs+4−2
@@ -133,15 +133,17 @@ char p = P $ \t -> case T.uncons t of
133133 Just (c,t') | p c -> Right (c,t')
134134 _ -> Left "char"
135135
136+data T = T !Integer !Int
137+
136138floaty :: RealFloat a => (Integer -> Integer -> Integer -> a) -> Lexer a
137139{-# INLINE floaty #-}
138140floaty f = runP $ do
139141 real <- signa (P decimal)
140− (fraction,fracDigits) <- perhaps (0,0) $ do
142+ T fraction fracDigits <- perhaps (T 0 0) $ do
141143 _ <- char (=='.')
142144 digits <- P $ \t -> Right (T.length $ T.takeWhile isDigit t, t)
143145 n <- P decimal
144− return (n, digits)
146+ return $ T n digits
145147 let e c = c == 'e' || c == 'E'
146148 power <- perhaps 0 (char e >> signa (P decimal) :: Parser Int)
147149 return $! if fracDigits == 0