haskell / haskell/binary

Calculate the length of a Builder without executing it

Ouverte
#12 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Haskell
Étoiles
120
Forks
70
Métriques de merge des PR
Aucune PR mergée en 30 j

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par lire Data.Binary.Builder et le module proposé Data.Binary.Builder.Sized. Le travail est terminé lorsqu’une API SizedBuilder transportant une longueur est exposée, avec sa longueur et les méthodes supplémentaires de Builder, sans la boucle récursive décrite.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
haskell
Domaine
data
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.