1 year ago
#222901
zaabson
Does stack rerun hpack not only on build but already on change?
I'm using stack with hpack so that .cabal
file is generated from hpack's package.yaml
. Often times as I want to switch branch I struggle with constantly changing .cabal
file.
- I run
git restore *.cabal
. Working tree is in unstaged state. - Immediately after I run
git switch branch
but get
error: Your local changes to the following files would be overwritten by checkout: Package.cabal
- The error message is correct as
.cabal
has changed and now there are uncommited changes. I didn't observe the exact circumstances but here myPaths_Package
differs between the branches.
Why does this happen? Does stack
rerun hpack
on every modification? Isn't it enough to recompute .cabal
before build?
This behaviour is frustrating and how I'm solving it for now is running as a single command:
git restore *.cabal && git switch branch
Above works. What does it tell about the moment of recomputation?
Important
Final thing is that the recomputation could be triggered from different source. I don't remember from where it comes from, but my terminal displays ghc version for the stack project on the side. My only idea on what triggers this is stack --bash-completion-script
. I have default manjaro zsh config with stack from aur. Is there some deamon waiting to stage some changes right when before switch?
Thanks in advance!
git
haskell
haskell-stack
hpack
0 Answers
Your Answer