
2 Aug
2014
2 Aug
'14
3:54 a.m.
quoth Elliot Robinson
As a quick usage/rationale overview, I feed an attoparsec parser by repeatedly calling receive (intermixed with some intelligent use of `transmit` to deal with messages and other incomplete screen updates) until I receive a valid map. `hGetNonBlocking` bypasses the standard buffering mechanisms and returns whatever is in the PTY buffer (which may be nothing) rather than waiting for the specified line/block/whatever buffer to fill.
If you don't really want non-blocking I/O (i.e., normally returns 0 bytes), System.Posix.IO.ByteString.fdRead is a blocking read that returns available unbuffered data. Handles are for buffered I/O. Donn