git.iko.soy/typeable/attoparsec
on master help sign in
Drop the second use of <|> from scientifically

--HG-- extra : rebase_source : d1700fbedb661d36abe723d463cc02e13c0dcdd4

commit3907e3469e440ac3d4d5528604d41e558307e789 authorBryan O'Sullivan <bos@serpentine.com> dateSun 11 May 2014, 22:39 (12 years ago) parent1da7481
1 file changed+5−3
Data/Attoparsec/ByteString/Char8.hs+5−3
Data/Attoparsec/ByteString/Char8.hs+5−3
@@ -567,9 +567,11 @@ scientifically h = do
567567 (negate $ B8.length fracDigits)
568568 step a w = a * 10 + fromIntegral (w - 48)
569569
570− s <- let dot = 46 in
571− (I.satisfy (==dot) *> (f <$> I.takeWhile isDigit_w8)) <|>
572− pure (Sci.scientific n 0)
570+ dotty <- I.peekWord8
571+ -- '.' -> ascii 46
572+ s <- case dotty of
573+ Just 46 -> I.anyWord8 *> (f <$> I.takeWhile isDigit_w8)
574+ _ -> pure (Sci.scientific n 0)
573575
574576 let !signedCoeff | positive = coefficient s
575577 | otherwise = negate $ coefficient s