Skip to content

Make ShortText a type synonym of Text#11846

Open
Bodigrim wants to merge 3 commits into
masterfrom
make-shorttext-text
Open

Make ShortText a type synonym of Text#11846
Bodigrim wants to merge 3 commits into
masterfrom
make-shorttext-text

Conversation

@Bodigrim
Copy link
Copy Markdown
Collaborator

@Bodigrim Bodigrim commented May 17, 2026

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.

Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

@Bodigrim Bodigrim force-pushed the make-shorttext-text branch 5 times, most recently from 7d4e2fb to 5b7c912 Compare May 19, 2026 21:46
Comment thread Cabal-syntax/src/Distribution/Utils/ShortText.hs
@Bodigrim Bodigrim force-pushed the make-shorttext-text branch from 5b7c912 to 42e7f10 Compare May 21, 2026 21:58
@Bodigrim Bodigrim added merge me Tell Mergify Bot to merge and removed attention: needs-review labels May 21, 2026
@mergify mergify Bot added the ready and waiting Mergify is waiting out the cooldown period label May 21, 2026
@Bodigrim Bodigrim force-pushed the make-shorttext-text branch 2 times, most recently from 4c6140a to 2d35cfa Compare May 22, 2026 21:09
Bodigrim added 2 commits May 23, 2026 10:07
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.
@Bodigrim Bodigrim force-pushed the make-shorttext-text branch from 2d35cfa to 2431606 Compare May 23, 2026 09:07
@Bodigrim Bodigrim force-pushed the make-shorttext-text branch from 7b9b953 to 6be026f Compare May 23, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge me Tell Mergify Bot to merge ready and waiting Mergify is waiting out the cooldown period

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants