Calculate the length of a Builder without executing it
- Vorherrschende Sprache
- Haskell
- Sterne
- 120
- Forks
- 70
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
In the ELF format, there are absolute offsets pointing to positions after the offset.
Thus, calculating this offset requires knowing the length of several Builders, including the length of the Builder that will contain the offset itself.
With the current API and a naive approach that would force the Builders into lazy ByteStrings, you'd end up with <>.
One simple solution, suggested by Joe Hendrix, is to wrap the Builder in a type that contains the Builder and it's length.
data SizedBuilder = SB Int64 Builder
length (SB l _) = l
… + additional methods exported by Data.Binary.Builder
This API could be exposed from Data.Binary.Builder.Sized.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.