| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Network.Attoparsec
Description
Utility functions for running a parser against a socket
Documentation
Arguments
| :: (MonadIO m, MonadError String m, Show a) | |
| => Socket | Socket to read data from |
| -> ParseC a | Initial parser state |
| -> ParseC a | Continuation parser state |
| -> m (ParseC a, [a]) | Next parser state with parsed values |
Incrementally reads data from socket and parses as many objects as possible
Arguments
| :: (MonadIO m, MonadError String m, Show a) | |
| => Socket | Socket to read data from |
| -> ParseC a | Initial parser state |
| -> m a | Parsed value |
Similar to parseMany, but assumes that there will only be enough data for a single succesful parse on the socket, and guarantees that exactly one item will be parsed.
Warning: this function will not work correctly when input data is pipelined. The parser might consume more data than required from the socket, or a partial second object is parsed, and the parser state and buffer will be discarded.