Skip to content
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

cabal repl should turn on the default extensions #8539

Closed
dmwit opened this issue Oct 17, 2022 · 4 comments
Closed

cabal repl should turn on the default extensions #8539

dmwit opened this issue Oct 17, 2022 · 4 comments

Comments

@dmwit
Copy link
Collaborator

dmwit commented Oct 17, 2022

If I specify default-extensions in my cabal file, that's likely because those are frequently needed (or wanted) when playing with things in that component. Since the primary thing you do in cabal repl is play with things in a component, you tend to frequently want those same extensions turned on in the ghci session (or at least, I tend to frequently want that). I can turn them on myself, of course, as I discover I need them, but it would be nice for cabal to do it for me.

@jneira
Copy link
Member

jneira commented Oct 18, 2022

Hi, thanks for the proposal which at a first glance makes sense. One possible workaround is set the extensions in a ghci specific config file (~/.ghc/ghci.conf, ./.ghci) to not have to set them manually, but you still have to duplicate them in two places
Issues related: #7696 and the issues linked there

@jneira
Copy link
Member

jneira commented Oct 18, 2022

Hi again, what versions of ghc and cabal are you using? It seems it works for me with cabal-3.8.1.0 and ghc-8.10.7

I've added in my cabal-test.cabal, in an executable stanza, default-extensions: LambdaCase, OverloadedStrings
And then i've run cabal repl -v to have more verbose output:

PS D:\dev\ws\haskell\cabal-test> cabal repl cabal-test:exe:cabal-test -v
...
"D:\ghcup\bin\ghc.exe" "--interactive" "-fbuilding-cabal-package" "-O0" "-outputdir" "D:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\cabal-test\cabal-test-tmp" "-odir" "D:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\cabal-test\cabal-test-tmp" "-hidir" "D:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\cabal-test\cabal-test-tmp" "-stubdir" "D:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\cabal-test\cabal-test-tmp" "-i" "-iD:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\cabal-test\cabal-test-tmp" "-icommon-src" "-iapp" "-iD:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\cabal-test\autogen" "-iD:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\global-autogen" "-ID:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\cabal-test\autogen" "-ID:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\global-autogen" "-ID:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\cabal-test\cabal-test-tmp" "-ID:\ghcup\msys64\mingw64\include" "-optP-include" "-optPD:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\build\cabal-test\autogen\cabal_macros.h" "-LD:\ghcup\msys64\mingw64\lib" "-hide-all-packages" "-Wmissing-home-modules" "-no-user-package-db" "-package-db" "D:\cabal\store\ghc-8.10.7\package.db" "-package-db" "D:\dev\ws\haskell\cabal-test\dist-newstyle\packagedb\ghc-8.10.7" "-package-db" "D:\dev\ws\haskell\cabal-test\dist-newstyle\build\x86_64-windows\ghc-8.10.7\cabal-test-0.1.0.0\x\cabal-test\package.conf.inplace" "-package-id" "base-4.14.3.0" "-package-id" "bytestring-0.10.12.0" "-package-id" "cabal-test-0.1.0.0-inplace" "-XHaskell2010" "-XLambdaCase" "-XOverloadedStrings" "app\Main.hs" "MyExe.MyModule" "MyExe.MyPrefix.MyModule2" "-hide-all-packages"
GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
[1 of 3] Compiling MyExe.MyModule   ( app\MyExe\MyModule.hs, interpreted )
[2 of 3] Compiling Main             ( app\Main.hs, interpreted )
[3 of 3] Compiling MyExe.MyPrefix.MyModule2 ( app\MyExe\MyPrefix\MyModule2.hs, interpreted )
Ok, three modules loaded.
*Main> "hi" :: BS.ByteString
"hi"
*Main>

Observe that the ghc --interactive final invocation includes the default-extensions of the cabal file.

Could you share the output of cabal repl target -v?

@Mikolaj
Copy link
Member

Mikolaj commented Nov 3, 2022

@dmwit: ping?

@dmwit
Copy link
Collaborator Author

dmwit commented Dec 12, 2022

Not sure which project I was having this problem on. Seems to be working now on the one I thought most likely to be the culprit, so I guess better close as not reproducible.

@dmwit dmwit closed this as completed Dec 12, 2022
@andreasabel andreasabel closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2022
@andreasabel andreasabel added the resolution: invalid Not an issue (error on the side of the reporter) label Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants