Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Lines = Lines {}
- emptyLines :: Lines
- addLines :: ByteString -> Lines -> Lines
- linesFromBS :: ByteString -> Lines
- unLines :: Lines -> ByteString
- lastWholeLine :: Lines -> Maybe ByteString
- splitLinesOn :: (ByteString -> Bool) -> Lines -> Maybe (Lines, Lines)
- newLines :: (Reflex t, MonadHold t m, MonadFix m) => Event t ByteString -> Event t () -> m (Event t Lines)
Output lines
Accumulator for line-based output that keeps track of any dangling, unterminated line
emptyLines :: Lines Source #
Empty output
addLines :: ByteString -> Lines -> Lines Source #
Add some raw output to a Lines
. This will chop the raw output up into lines.
linesFromBS :: ByteString -> Lines Source #
Convert a ByteString
into a Lines
unLines :: Lines -> ByteString Source #
Convert a Lines
back into a ByteString
lastWholeLine :: Lines -> Maybe ByteString Source #
Convenience accessor for the last whole line received by a Lines
.
Ignores any unterminated line that may follow.
splitLinesOn :: (ByteString -> Bool) -> Lines -> Maybe (Lines, Lines) Source #
Split lines into two. The sequence that satisfies the predicate is
consumed and will not appear in either resulting Lines
.
:: (Reflex t, MonadHold t m, MonadFix m) | |
=> Event t ByteString | |
-> Event t () | Event that flushes any remaining unterminated lines |
-> m (Event t Lines) | These will be complete lines except when the flush event fires, in which it may include unterminated lines |
Given an event of raw bytes, fire an output event of *terminated* lines. Unterminated lines are held until the line they belong to is completed or until the flush event fires.