Skip to content

Share empty lines - #727

Merged
Bodigrim merged 2 commits into
haskell:masterfrom
vdukhovni:share-empty-lines
Nov 18, 2026
Merged

Bodigrim merged 2 commits into
haskell:masterfrom
vdukhovni:share-empty-lines

Conversation

@vdukhovni

Copy link
Copy Markdown
Contributor

Empty lines produced by lines are returned via the shared empty value.

Empty lines produced by `lines` are returned via the shared `empty`
value.
@vdukhovni

Copy link
Copy Markdown
Contributor Author

The CI build error seems spurious or at least unrelated to the pull request:

Failed to build terminal-size-0.3.4.
Build log (
/home/runner/.cabal/logs/ghc-9.2.8/terminal-size-0.3.4-5d99ef4fb1564dcdc3efcb95ce93a63daaf9e9dbd837bba93246205b420ed4c1.log
):
Configuring library for terminal-size-0.3.4...
linking dist/build/System/Console/Terminal/Posix_hsc_make.o failed (exit code 1)
rsp file was: "dist/build/System/Console/Terminal/hsc2hscall5662-2.rsp"
Error: [Cabal-7125]
Failed to build terminal-size-0.3.4 (which is required by test:bytestring-tests from bytestring-0.13.0.0). See the build log above for details.
command was: /usr/bin/gcc dist/build/System/Console/Terminal/Posix_hsc_make.o dist/build/System/Console/Terminal/Posix_hsc_utils.o -o dist/build/System/Console/Terminal/Posix_hsc_make -fuse-ld=gold -L/usr/local/.ghcup/ghc/9.2.8/lib/ghc-9.2.8/lib/../lib/x86_64-linux-ghc-9.2.8/base-4.16.4.0 -Wl,-R,/usr/local/.ghcup/ghc/9.2.8/lib/ghc-9.2.8/lib/../lib/x86_64-linux-ghc-9.2.8/base-4.16.4.0 -L/usr/local/.ghcup/ghc/9.2.8/lib/ghc-9.2.8/lib/../lib/x86_64-linux-ghc-9.2.8/ghc-bignum-1.2 -Wl,-R,/usr/local/.ghcup/ghc/9.2.8/lib/ghc-9.2.8/lib/../lib/x86_64-linux-ghc-9.2.8/ghc-bignum-1.2 -lgmp -L/usr/local/.ghcup/ghc/9.2.8/lib/ghc-9.2.8/lib/../lib/x86_64-linux-ghc-9.2.8/ghc-prim-0.8.0 -Wl,-R,/usr/local/.ghcup/ghc/9.2.8/lib/ghc-9.2.8/lib/../lib/x86_64-linux-ghc-9.2.8/ghc-prim-0.8.0 -lc -lm -L/usr/local/.ghcup/ghc/9.2.8/lib/ghc-9.2.8/lib/../lib/x86_64-linux-ghc-9.2.8/rts-1.0.2 -Wl,-R,/usr/local/.ghcup/ghc/9.2.8/lib/ghc-9.2.8/lib/../lib/x86_64-linux-ghc-9.2.8/rts-1.0.2 -lrt -ldl
error: collect2: fatal error: cannot find ‘ld’

@Bodigrim

Copy link
Copy Markdown
Contributor

It seems something changed in the CI image since ubuntu-latest started pointing to 26.04 instead of 24.04. While at it, could you please pin it to ubuntu-24.04?

@Bodigrim Bodigrim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason that this optimisation is important?

@vdukhovni

Copy link
Copy Markdown
Contributor Author

Is there a particular reason that this optimisation is important?

It is not very compelling, but it seems like the right thing to do, and explicit empty is returned in similar situations elsewhere in the code. This is also cheap to execute. When the input has a lot of empty lines, this saves space and could avoid keeping the foreign pointer alive if no other references remain.

@Bodigrim
Bodigrim merged commit 8e320b4 into haskell:master Nov 18, 2026
26 checks passed
@Bodigrim

Copy link
Copy Markdown
Contributor

Thanks!

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