Skip to content

Commit

Permalink
todo tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
raehik committed Nov 29, 2023
1 parent 98e9d22 commit a3aaba2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 27 deletions.
46 changes: 19 additions & 27 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# binrep to-dos
## Test new parser errors
Where we keep track of the offset. It's very weird and probably bad :(

## Intermediate types should use the bytestring builder type, not a bytestring
Saves on allocations if you're just gonna serialize. Specifically, the text
modules probably want this. Not sure how to do it exactly to retain maximum
soundness.
## Write more primitives
* Varint
* base done, but doesn't support everything
* `newtype Varint sign end = Varint { unVarint :: VarintRep sign }`
* apparently `Varint s 'LE` would be LEB128, `Varint s 'BE` would be VLQ
* https://developers.google.com/protocol-buffers/docs/encoding , Mason
* byte-oriented, so each byte is 0-127 instead of 0-255.
* protobuf uses little endian, twos complement
* Wikipedia suggests we could support signed & unsigned:
https://en.wikipedia.org/wiki/LEB128
* ZigZag
* Maps signed to unsigned
* `newtype ZigZag size end = ZigZag { unZigZag :: I 'S size end }`
* https://developers.google.com/protocol-buffers/docs/encoding
* https://hackage.haskell.org/package/zigzag-0.0.1.0/docs/Data-Word-Zigzag.html

This might be a big change. I need to check aeson's design more thoroughly, it'd
look like the `Encoding` stuff.
## Define types for some common file formats
* How about a shared type for xz

2023-02-19: No, actually, I think this is a Text-unique thing, and they just
need some extra definitions.
## Test new parser errors
Where we keep track of the offset. It's very weird and probably bad :(

## Octet instead of byte?
Is it better to refer to octets instead of bytes? An octet is always 8 bits,
Expand All @@ -26,22 +34,6 @@ Consider implementing "practical maxes" for various types.

May help prevent unexpected OOMs?

## More primitives
* Varint
* base done, but doesn't support everything
* `newtype Varint sign end = Varint { unVarint :: VarintRep sign }`
* apparently `Varint s 'LE` would be LEB128, `Varint s 'BE` would be VLQ
* https://developers.google.com/protocol-buffers/docs/encoding , Mason
* byte-oriented, so each byte is 0-127 instead of 0-255.
* protobuf uses little endian, twos complement
* Wikipedia suggests we could support signed & unsigned:
https://en.wikipedia.org/wiki/LEB128
* ZigZag
* Maps signed to unsigned
* `newtype ZigZag size end = ZigZag { unZigZag :: I 'S size end }`
* https://developers.google.com/protocol-buffers/docs/encoding
* https://hackage.haskell.org/package/zigzag-0.0.1.0/docs/Data-Word-Zigzag.html

## Generate (human-readable) schema from type
I think I do this by writing yet another typeclass, filling it out for my
primitives, then writing yet another generic typeclass. But I'd like to make
Expand Down
File renamed without changes.

0 comments on commit a3aaba2

Please sign in to comment.