Alright, so I added two utilities to `pipes-parse` for converting
`Consumer`s to `Parser`s:
toParser :: Monad m => Consumer (Maybe a) m r -> Parser a m r
toParser' :: Monad m => Consumer a m X -> Parser a m ()
These cover most common cases with good efficiency.
Also, I noticed there was a slight mistake in my example implementation of
`maxLines` because it was not consuming the newline byte. The correct
version is this:
maxLines n = iso (cut n) join
where
cut 0 p = return p
cut n p = do
p' <- p ^. PB.line
p'' <- lift (execStateT PB.drawByte p') -- Drain newline byte
cut (n - 1) p''
--
You received this message because you are subscribed to the Google Groups
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].