-
-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding (\\) operator to import list adds it without surrounding it in parenthesis #2451
Comments
Interesting. ~/Tmp> ghcup set ghc 8.8.4
[ Info ] GHC 8.8.4 successfully set as default version
~/Tmp> ghc Demo.hs
[1 of 1] Compiling Demo ( Demo.hs, Demo.o )
Demo.hs:3:12: error:
• Variable not in scope: (\\) :: [Bool] -> [a0] -> t
• Perhaps you want to add ‘\\’ to the import list in the import of
‘Data.List’ (Demo.hs:2:1-19).
|
3 | x = [True] \\ []
| ^^
~/Tmp> ghcup set ghc 8.10.7
[ Info ] GHC 8.10.7 successfully set as default version
~/Tmp> ghc Demo.hs
[1 of 1] Compiling Demo ( Demo.hs, Demo.o )
Demo.hs:3:12: error:
• Variable not in scope: (\\) :: [Bool] -> [a0] -> t
• Perhaps you want to add ‘\\’ to the import list in the import of
‘Data.List’ (Demo.hs:2:1-19).
|
3 | x = [True] \\ []
| ^^
~/Tmp> ghcup set ghc 9.0.1
[ Info ] GHC 9.0.1 successfully set as default version
~/Tmp> ghc Demo.hs
[1 of 1] Compiling Demo ( Demo.hs, Demo.o )
Demo.hs:3:12: error:
• Variable not in scope: (\\) :: [Bool] -> [a0] -> t
• Perhaps you want to add ‘\\’ to the import list in the import of
‘Data.List’ (Demo.hs:2:1-19).
|
3 | x = [True] \\ []
| ^^
~/Tmp> ghcup set ghc 9.2.1
[ Info ] GHC 9.2.1 successfully set as default version
~/Tmp> ghc Demo.hs
[1 of 1] Compiling Demo ( Demo.hs, Demo.o )
Demo.hs:3:12: error:
• Variable not in scope: (\\) :: [Bool] -> [a0] -> t
• Perhaps you want to add ‘\\’ to the import list in the import of
‘Data.List’ (Demo.hs:2:1-19).
|
3 | x = [True] \\ []
| ^^ Can you please compile this module on command line and share the output that ghc gives you? module Demo where
import Data.List ()
x = [True] \\ [] |
I am just aware i am on 1.5.0 so maybe it is a regression EDIT: Just tried with 1.5.1 and it worked fine too |
with ghc-9.0.1
|
Thank you for checking. |
I found where the issue is coming from. I'll see if I can come up with reasonably simple reproducer for tests 😅 |
Alright, I'm closer to the root cause, but not sure if there's good way to write a reproducer for tests. Why is
This most likely happens because base-noprelude doesn't actually contain any modules, it only re-exports modules from the In light of this I'm not sure what's the best way to apply the fix:
|
I think you have tracked down the bug. Amazing work! We probably shouldn't be ignoring the second component returned by
https://hackage.haskell.org/package/ghc-9.2.1/docs/GHC-Unit-Info.html#v:unitExposedModules |
I think this got fixed. |
Your environment
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.5.1.0, Git revision dcd2163 (2504 commits) x86_64 ghc-8.10.7
Current directory: /home/jhrcek/Devel/github.com/Holmusk/PI/backend
Operating system: linux
Arguments: ["--lsp"]
Cradle directory: /home/jhrcek/Devel/github.com/Holmusk/PI/backend
Cradle type: Stack
Tool versions found on the $PATH
cabal: 3.6.2.0
stack: 2.7.3
ghc: 8.10.7
Steps to reproduce
See this gif
Expected behaviour
The
\\
operator should be surrounded in()
after it's added to import listActual behaviour
The
\\
operator is added without()
The text was updated successfully, but these errors were encountered: