
Hi, Am Donnerstag, den 16.01.2014, 11:34 +0100 schrieb Heinrich Apfelmus:
Fortunately, we do known the spine of `offsets` in advance: it has the same spine as `byteStrings`. The solution is to make that explicit in the code, by using a lazy `zip`:
... mapM_ putWord32 (offsets `spine` byteStrings) ...
where spine :: [a] -> [void] -> [a] spine ~[] [] = [] spine ~(x:xs) (y:ys) = x : tag xs ys
This code takes the spine of `byteStrings` and fills it with values from `offsets`.
I thought about something in that direction; but thanks for working it out. What I do not like about this solution is that it is not safe: As a programmer I have two make sure that offsets and byteStrings actually have the same length. Greetings, Joachim -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de Jabber-ID: nomeata@joachim-breitner.de