Add check for "dotlines" with cabal 3.0+#11571
Open
tbidne wants to merge 3 commits intohaskell:masterfrom
Open
Add check for "dotlines" with cabal 3.0+#11571tbidne wants to merge 3 commits intohaskell:masterfrom
tbidne wants to merge 3 commits intohaskell:masterfrom
Conversation
61c1fc5 to
9fbdaaa
Compare
geekosaur
requested changes
Mar 3, 2026
9fbdaaa to
11d71af
Compare
geekosaur
approved these changes
Mar 4, 2026
humh25
approved these changes
Mar 4, 2026
11d71af to
050a595
Compare
philderbeast
approved these changes
Mar 4, 2026
Comment on lines
+455
to
+464
| parseLine3 p bs = do | ||
| when (s' == ".") $ parseWarning p PWTDotline msg | ||
| pure s | ||
| where | ||
| s = fromUTF8BS bs | ||
| s' = trim s | ||
|
|
||
| msg = | ||
| "Empty lines with a dot '.' are unnecessary for creating newlines " | ||
| ++ "(and treated literally) in cabal 3.0+" |
Collaborator
There was a problem hiding this comment.
With -XViewPatterns, you could skip binding bs. Bindings for s' and msg could also be skipped.
Suggested change
| parseLine3 p bs = do | |
| when (s' == ".") $ parseWarning p PWTDotline msg | |
| pure s | |
| where | |
| s = fromUTF8BS bs | |
| s' = trim s | |
| msg = | |
| "Empty lines with a dot '.' are unnecessary for creating newlines " | |
| ++ "(and treated literally) in cabal 3.0+" | |
| parseLine3 p (fromUTF8BS -> s) = do | |
| when (trim s == ".") . parseWarning p PWTDotline $ | |
| "Empty lines with a dot '.' are unnecessary for creating newlines " | |
| ++ "(and treated literally) in cabal 3.0+" | |
| pure s |
Contributor
Author
There was a problem hiding this comment.
Reasonable, though I think turning on ViewPatterns for the whole module is overkill, just for this. I don't feel strongly though.
050a595 to
f17b0bc
Compare
- Follow cabal suggestion: use findWithDefault
Cabal 3.0 changed the parser for "free text" fields (e.g. description)
such that:
1. Empty lines and indentation are preserved.
2. Empty lines with a dot '.' (and possible whitespace) are
interpreted literally; they are no longer interpreted as an
empty line.
Consequently, dotlines no longer serve a purpose and only add extra
noise, hence are given a warning.
See haskell#11518.
f17b0bc to
06a5812
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.
Adds a warning for #11518. I'm not too familiar with this part of the codebase, but the changes seem straightforward.
Essentially wraps
with
which adds a warning if the string matches the same dot check pre-3.0 (
trim bs == "."). The rest is just mechanical changes to accommodate theParseResult.Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
significance: significantin the changelog file.