| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Attoparsec.ByteString.Streaming
- type Message = ([String], String)
- parse :: Monad m => Parser a -> ByteString m x -> m (Either a Message, ByteString m x)
- parsed :: Monad m => Parser a -> ByteString m r -> Stream (Of a) m (Either (Message, ByteString m r) r)
- module Data.Attoparsec.ByteString
Documentation
parse :: Monad m => Parser a -> ByteString m x -> m (Either a Message, ByteString m x) Source
The result of a parse (Either a ([String], String)), with the unconsumed byte stream.
>>>(r,rest1) <- parse (A.scientific <* A.many' A.space) $ "12.3 4.56 78." >> "3">>>print rLeft 12.3>>>(s,rest2) <- parse (A.scientific <* A.many' A.space) rest1>>>print sLeft 4.56>>>(t,rest3) <- parse (A.scientific <* A.many' A.space) rest2>>>print tLeft 78.3>>>Q.putStrLn rest3
Arguments
| :: Monad m | |
| => Parser a | Attoparsec parser |
| -> ByteString m r | Raw input |
| -> Stream (Of a) m (Either (Message, ByteString m r) r) |
Parse a succession of values from a stream of bytes, ending when the parser fails.or the bytes run out.
>>>S.print $ AS.parsed (A.scientific <* A.many' A.space) $ "12.3 4.56 78." >> "9 18.282"12.3 4.56 78.9 18.282
module Data.Attoparsec.ByteString