on master help sign in
Add an example to make a scientific parser
0908f77Adithya Kumar
core/src/Streamly/Internal/Unicode/Parser.hs+2
@@ -290,6 +290,8 @@ data ScientificParseState
290-- exponent) tuple. The result can be mapped to 'Double' or any other number
290-- exponent) tuple. The result can be mapped to 'Double' or any other number
291-- representation e.g. @Scientific@.
291-- representation e.g. @Scientific@.
292--
292--
293+-- For example, using the @scientific@ package:
294+-- >> parserScientific = uncurry Data.Scientific.scientific <$> 'number'
293{-# INLINE number #-}
295{-# INLINE number #-}
294number :: Monad m => Parser Char m (Integer, Int)
296number :: Monad m => Parser Char m (Integer, Int)
295number = Parser (\s a -> return $ step s a) initial (return . extract)
297number = Parser (\s a -> return $ step s a) initial (return . extract)