Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Setting -XTemplateHaskell in GHCi unloads modules that were specified on the command-line
## Summary Running `:set -XTemplateHaskell` in `ghci` (in some situations) has two side effects: 1. The scope is cleared 1. Any modules that were specified on the command line are unloaded While (1) is inconvenient, I have a hard time considering (2) as acceptable. This also breaks `doctest`. I haven't been able to reproduce the issue without `cabal exec` (e.g. with a `.ghc.enviroment`-file). Not exactly sure what's the difference. From the `ghci` output ``` package flags have changed, resetting and loading new packages... ``` I guess that it's somehow related to this code: https://gitlab.haskell.org/ghc/ghc/-/blob/master/ghc/GHCi/UI.hs#L3120 ## Steps to reproduce Given: ``` -- foo.cabal cabal-version: 3.6 name: foo version: 0.0.0 library build-depends: base ``` ```haskell -- Foo.hs module Foo where foo :: Int foo = 23 ``` Run: ```bash $ cabal build . && cabal exec ghci Foo.hs ghci> foo 23 ghci> :set -XTemplateHaskell package flags have changed, resetting and loading new packages... ghci> foo ``` ## Expected behavior `foo` should still be in scope: ``` ghci> foo 23 ``` ## Actual behavior `foo` is not in scope: ``` ghci> foo <interactive>:3:1: error: Variable not in scope: foo ``` ## Environment * GHC version used: 9.2.1 ``` $ cabal --version && uname -s -m cabal-install version 3.6.2.0 compiled using version 3.6.2.0 of the Cabal library Linux x86_64 ```
issue