Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This is equivalent to the http://hackage.haskell.org/package/pipes-bytestring/docs/Pipes-ByteString.html#v:lines except it works for lines delimited with "\r\n"
Warning: Since this works on bytestrings, it assumes a particular encoding. You should use Pipes.Text.Lines if possible.
- lines :: Monad m => Lens' (Producer ByteString m r) (FreeT (Producer ByteString m) m r)
- unlines :: Monad m => Lens' (FreeT (Producer ByteString m) m r) (Producer ByteString m r)
- line :: Monad m => Producer ByteString m r -> Producer ByteString m (Producer ByteString m r)
Documentation
lines :: Monad m => Lens' (Producer ByteString m r) (FreeT (Producer ByteString m) m r) Source #
Producer of strict ByteString
s is delimited by "\r\n"
>>>
runEffect $ for (over (lines . individually) (<* yield "!") (yield "asdf\r\nqwerty\r\n")) (lift . print)
"asdf" "!" "\r\n" "qwerty" "!" "\r\n"
unlines :: Monad m => Lens' (FreeT (Producer ByteString m) m r) (Producer ByteString m r) Source #
line :: Monad m => Producer ByteString m r -> Producer ByteString m (Producer ByteString m r) Source #
Producer which consumes a single line, then returns a producer with rest of input.
>>>
rest <- runEffect $ for (line (yield "foo\r\nbar\r\nbaz\r\n")) (lift . print)
"foo">>>
runEffect $ for rest (lift . print)
"bar\r\nbaz\r\n"