commercialhaskell / commercialhaskell/stack
Plan for "stack ghci" to properly handle different default-extensions in different components
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
Conflicts between extensions is the primary cause of `stack ghci` not working properly with a multi-package / multi-component project. This is why I added code to describe to the user the conflicts that could occur: https://github.com/commercialhaskell/stack/issues/1270
When looking at the code for `ghci` (well, `intero`! https://github.com/chrisdone/intero), I noticed that it's actually quite feasible for us to do the following in the ghci script:
```
:set -XTemplateHaskell
:add Pkg1Module
:set -XNoTemplateHaskell
:add Pkg2Module
```
In this case, `pkg1` has TemplateHaskell specified as a `default-extension`. `pkg2` doesn't, so it gets unset before loading those modules. The tricky part of this is that these loads need to be done in dependency order.
Another approach, which will hopefully also be taken, is to solve this more completely in intero itself: https://github.com/chrisdone/intero/issues/41 . It seems reasonably feasible to have different flags for different modules. With this approach, we don't need to worry about knowing the order of dependencies as that can just be handled by normal ghc logic. On the other hand, it'd be good for `stack` to use vanilla `ghci` well too.
Contributor guide
Assessment
This issue has not been assessed yet.