Skip to content

v1.5.0: Add BuildM and modify Repeated and BuildR for efficiency. - #115

Merged
j6carey merged 1 commit into
masterfrom
foldMap-with-oneShot-BuildR
May 4, 2026
Merged

j6carey merged 1 commit into
masterfrom
foldMap-with-oneShot-BuildR

Conversation

@j6carey

@j6carey j6carey commented May 3, 2026

Copy link
Copy Markdown
Collaborator

1.5.0

  • As a breaking change, modify Repeated and ToRepeated to use foldMap-style folds and thereby avoid allocation of BuildR functions on the heap. Use of FoldR seemed to force such allocation, even when using oneShot.
  • Use oneShot in BuildR and FixedPrim to discourage allocation of such function newtypes on the heap in other scenarios.
  • Add BuildM and associated features for monadic building.
  • Add PackedField to support packed fields in a uniform fashion, and directly implement omission of such a field when it is empty.
  • Add embeddedIfNonempty as a way to omit empty length-delimited fields.
  • Deprecate FoldR and unsafeReverseFoldMapFixedPrim because we have stopped using them and plan to remove them in future.

@j6carey
j6carey requested a review from riz0id May 3, 2026 20:02
@j6carey
j6carey force-pushed the foldMap-with-oneShot-BuildR branch 2 times, most recently from 338a679 to 9979c17 Compare May 3, 2026 23:12
1.5.0
  - As a breaking change, modify `Repeated` and `ToRepeated` to use `foldMap`-style
    folds and thereby avoid allocation of `BuildR` functions on the heap.  Use
    of `FoldR` seemed to force such allocation, even when using `oneShot`.
  - Use `oneShot` in `BuildR` and `FixedPrim` to discourage allocation
    of such function newtypes on the heap in other scenarios.
  - Add `BuildM` and associated features for monadic building.
  - Add `PackedField` to support packed fields in a uniform fashion,
    and directly implement omission of such a field when it is empty.
  - Add `embeddedIfNonempty` as a way to omit empty length-delimited fields.
  - Deprecate `FoldR` and `unsafeReverseFoldMapFixedPrim` because
    we have stopped using them and plan to remove them in future.
@j6carey
j6carey force-pushed the foldMap-with-oneShot-BuildR branch from e1ef522 to 3c689a9 Compare May 4, 2026 01:45
Comment thread src/Proto3/Wire/Reverse/Prim.hs
@j6carey
j6carey merged commit 796950b into master May 4, 2026
19 checks passed
@j6carey
j6carey deleted the foldMap-with-oneShot-BuildR branch May 4, 2026 17:59
@alexfmpe alexfmpe mentioned this pull request Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants