Make ShortText a type synonym of Text#11846
Open
Bodigrim wants to merge 3 commits into
Open
Conversation
7d4e2fb to
5b7c912
Compare
philderbeast
approved these changes
May 20, 2026
Mikolaj
approved these changes
May 21, 2026
5b7c912 to
42e7f10
Compare
4c6140a to
2d35cfa
Compare
The data type `Distribution.Utils.ShortText` was introduced in 2016 (993d20a) to provide a compact representation of UTF-8 strings. Since then the ecosystem moved forward and converged to using `Data.Text.Text` for this purpose. The commit defines `type ShortText = Text` and retains `Distribution.Utils` as a boring compatibility layer. An alert reader can object that while `Data.Text.Text` is also UTF-8 encoded, its memory overhead is a few bytes more than `Distribution.Utils.ShortText` (because `Text` provides constant-time slicing, while `ShortText` takes linear time). My experience as a maintainer of `bytestring` and `text` is that this memory overhead is unlikely to matter for Cabal use case, and reducing mental overhead takes the priority.
2d35cfa to
2431606
Compare
7b9b953 to
6be026f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The data type
Distribution.Utils.ShortTextwas introduced in 2016 (993d20a) to provide a compact representation of UTF-8 strings. Since then the ecosystem moved forward and converged to usingData.Text.Textfor this purpose. The commit definestype ShortText = Textand retainsDistribution.Utilsas a boring compatibility layer.An alert reader can object that while
Data.Text.Textis also UTF-8 encoded, its memory overhead is a few bytes more thanDistribution.Utils.ShortText(becauseTextprovides constant-time slicing, whileShortTexttakes linear time). My experience as a maintainer ofbytestringandtextis that this memory overhead is unlikely to matter for Cabal use case, and reducing mental overhead takes the priority.Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
significance: significantin the changelog file.