Calculate the length of a Builder without executing it
- Dominant language
- Haskell
- Stars
- 120
- Forks
- 70
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.