git.iko.soy/typeable/attoparsec
on master help sign in
Drop the second use of <|> from scientifically
3907e34Bryan O'Sullivan
Data/Attoparsec/ByteString/Char8.hs+5−3
@@ -567,9 +567,11 @@ scientifically h = do
567 (negate $ B8.length fracDigits)
567 (negate $ B8.length fracDigits)
568 step a w = a * 10 + fromIntegral (w - 48)
568 step a w = a * 10 + fromIntegral (w - 48)
569
569
570− s <- let dot = 46 in
570+ dotty <- I.peekWord8
571+ -- '.' -> ascii 46
572+ s <- case dotty of
571− (I.satisfy (==dot) *> (f <$> I.takeWhile isDigit_w8)) <|>
573+ Just 46 -> I.anyWord8 *> (f <$> I.takeWhile isDigit_w8)
572− pure (Sci.scientific n 0)
574+ _ -> pure (Sci.scientific n 0)
573
575
574 let !signedCoeff | positive = coefficient s
576 let !signedCoeff | positive = coefficient s
575 | otherwise = negate $ coefficient s
577 | otherwise = negate $ coefficient s