Use list literal suggestions with `:|`
philderbeast opened this issue · 0 comments
philderbeast commented
With agda/agda@0ff0741, and the following diff, I'm getting suggestions that don't compile.
git diff
diff --git a/.hlint.yaml b/.hlint.yaml
index ccd486368..8daec1b5e 100644
--- a/.hlint.yaml
+++ b/.hlint.yaml
@@ -74,7 +74,6 @@
- ignore: {name: "Use isNothing"} # 2 hints
- ignore: {name: "Use join"} # 2 hints
- ignore: {name: "Use lambda-case"} # 11 hints
-- ignore: {name: "Use list literal"} # 12 hints
- ignore: {name: "Use list literal pattern"} # 1 hint
- ignore: {name: "Use map once"} # 1 hint
- ignore: {name: "Use map with tuple-section"} # 4 hints
The suggestions look wrong to me. Here's one I ran through GHCI
.
test/Internal/Utils/Cluster.hs:86:5-37: Suggestion: Use list literal
Found:
"anabel" :| "bond" : "babel" : []
Perhaps:
["anabel" :| "bond", "babel"]
This is not the same.
$ ghci
GHCi, version 9.8.2: https://www.haskell.org/ghc/ :? for help
ghci> import Data.List.NonEmpty
ghci> "anabel" :| "bond" : "babel" : []
"anabel" :| ["bond","babel"]
ghci> ["anabel" :| "bond", "babel"]
<interactive>:3:3: error: [GHC-39999]
• No instance for ‘Data.String.IsString Char’
arising from the literal ‘"anabel"’
• In the first argument of ‘(:|)’, namely ‘"anabel"’
In the expression: "anabel" :| "bond"
In the expression: ["anabel" :| "bond", "babel"]
<interactive>:3:23: error: [GHC-39999]
• No instance for ‘Data.String.IsString (NonEmpty Char)’
arising from the literal ‘"babel"’
• In the expression: "babel"
In the expression: ["anabel" :| "bond", "babel"]
In an equation for ‘it’: it = ["anabel" :| "bond", "babel"]
In this instance, shouldn't the suggestion be changed to:
test/Internal/Utils/Cluster.hs:86:5-37: Suggestion: Use list literal
Found:
"anabel" :| "bond" : "babel" : []
Perhaps:
- ["anabel" :| "bond", "babel"]
+ "anabel" :| ["bond","babel"]