Yes `pipes-parse` is still the recommended way to parse things.
`pipes-attoparsec` is basically a wrapper around `pipes-parse` for the
very common case of using `attoparsec` parsers.
The basic division of labor between `attoparsec` parsers and `pipes`
parsers is:
* `attoparsec` parsers are more efficient, but they backtrack so they
don't run in constant space
* `pipes` parsers are less efficient, but they don't backtrack so they
run in constant space
So typically you will divide your input stream into small logical groups
(i.e. records, lines, frames, etc.). Within each logical group you can
use an `attoparsec` parser for efficient, backtracking parsing of that
group and then you use `Pipes.Attoparsec.parse` to "commit" (freeing the
consumed input).
`Pipes.Attoparsec.parsed` is a convenience function that covers the
common case of repeatedly parsing the same logical group over and over,
but really `Pipes.Attoparsec.parse` is the fundamental primitive for
`attoparsec`-based parsing.
Even if you don't need backtracking, I still recommend using
`attoparsec` to do most of the heavy lifting since it is more efficient
than `pipes-parse`.
On 12/16/14, 1:37 PM, Dan Burton wrote:
What is the status of parsing with pipes?
If I'm not mistaken, pipes-parse is still The Way To Go for parsing
with pipes. Here's the tutorial:
http://hackage.haskell.org/package/pipes-parse-3.0.2/docs/Pipes-Parse-Tutorial.html
-- Dan Burton
On Tue, Dec 16, 2014 at 7:51 AM, GS <[email protected] <mailto:[email protected]>>
wrote:
Hello,
I'm facing the problem that even though I'm able to make tiny
steps with pipes now I'm still unable to translate this into more
complicated application scenarios.
As an example, the application I'm working on requires two things:
- parsing of a binary file, specifically the header at the
beginning of the file
- random IO within the file to locations extracted as parsing
results from the header
and so on, very similar in purpose of a media file converter / editor.
Now if I had chosen Oleg's package from his website there is
already a detailed examples of this, namely his TIFF example.
However studying this will probably gain me nothing, as pipes in
not simply just another variation of the iteratee approach but
fundamentally different, as I have come to understand.
Gabriel would you be willing to provide a more elaborate example
of how to use pipes, maybe similar in scope to Oleg's TIFF example?
GS
--
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]
<mailto:haskell-pipes%[email protected]>.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
--
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]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
--
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].