[Haskell-cafe] haskell zlip read position

rahul gopinath at eecs.oregonstate.edu
Thu Jul 21 07:53:00 CEST 2011


Hi Nathan,

| It was purely just for demonstration. I did update the code with a few more
| comments, but the enumerator package may not be the easiest thing to grok.
| You might try putting up your current code and someone might be able to
| recommend a better or easier approach.

Thank you very much again, I am working on extracting a leaner version of my
parser that I can post to demonstrate the problem.

| If the git pack headers have lengths in them, you could do something as
| simple as calling hSeek to move a file handle to the next header and start
| your decoding over again.

That is the unfortunate part, git pack headers have the inflated
length rather than the entry length. So that length is unusable for
finding the next entry start.

| >    Thank you very for the solution, since I am somewhat new to haskell, I
| > am taking some time to digest it :). But it seems that you are using
| > header -> streamLength to find the length of a single entry. However this
| > info is not present in the protocol I am parsing (git server pack files)
| >
| > Have I understood your code correctly?
| >
| > | > Unfortunately the binary protocol itself is external, so can't use a
| > | > different
| > | > type of compression
| > | >
| > |
| > | Perhaps something like this would work: https://gist.github.com/1096039
| > |
| > | I didn't test to make sure it works, but you could probably hack together
| > a
| > | working solution using Data.Enumerator.Binary.isolate and the zlib-enum
| > | package.
| > |
| > | -n
| > ---~*~---
| >
| >
---~*~---




More information about the Haskell-Cafe mailing list