Hi,
I would like some guidance while working on nested pipes. I have an
infinite continuous stream of bytestring coming from a `responseBody`
(pipes-http). The Content-Type is text/event-stream.
I would like to convert the bytestring into text, split into line. Then I
need to keep some lines of interest (filter) that have a pattern that looks
like "data: JSON OBJECT", parse the JSON object and spit it into a database
with pipes-postgresql-simple.
I have started by defining a composing lens as such
decodeEvent ::
Monad m
=> Lens' (Producer ByteString m r)
(Producer Text m (Producer Text m (Producer ByteString m r)))
decodeEvent = PT.decodeUtf8 . PT.line
But working with 2 embedded producers does not seem easy.
Is there any need to go for `PT.lines` instead ?
decodeEvent' ::
Monad m
=> Lens' (Producer ByteString m r)
(FreeT (Producer Text m) m (Producer ByteString m r))
decodeEvent' = PT.decodeUtf8 . PT.lines
Thanks for your input.
--
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].