I can reproduce, but I don't really know what is going on.
How do you develop your package? For me, stack build just fails which could be the reason for this error.
When I use cabal, by either writing a hie.yaml file with:
cradle:
cabal:
or gen-hie > hie.yaml (although I have no idea why it does what I want), everything works as expected for me.
Your stack.yaml should have a packages field, I believe that's what the parse error is coming from:
resolver: lts-whatever
packages:
- .
extra-deps:
...
@fendor I did a fresh clone of my project, and stack build worked, though maybe there's something about my environment causing it to succeed where it shouldn't. I have been confused by stack before, by breaking projects I'm not working on, so there must be some sort of global state I don't understand.
@bubba This fixes it! I updated the stack.yaml as you suggested and things look great. 🤦♂️ sorry for the trouble, and thank you!
For posterity, I did find this in Stack's documentation:
The packages field is optional. If omitted, it is treated as:
packages:
- .
So this might still be regarded as a bug. I did close it because there's an easy workaround, but a PR wouldn't be the worst idea. Does anyone have any pointers as to where I would find this field if I was interested in making such a change?
I think this issue should be reopened. That field is indeed optional and many projects don't have it in their stack.yaml files.
Ok, reopened and renamed
I'll add the error message here, so the issue can still be found by searching for it, even though it is not in the title anymore
user error ("AesonException "Error in $:key\packages\" not found") compiler [1,1]
@armatures
Currently, it is unclear, who causes this issue. Afaict, it should be https://github.com/mpickering/hie-bios/, since it is the only tool that is aware of the build-tools.
First steps would be to see, if you can reproduce the issue with only hie-bios. E.g. hie-bios check src/Lib.gs or hie-bios check src/Lib.hs
Then which stack command invocation is broken.
Code for the stack action is here:
https://github.com/mpickering/hie-bios/blob/master/src/HIE/Bios/Cradle.hs#L614
Commands that we require to work:
stack exec ghc -- --numeric-version
stack repl --no-nix-pure -w <some custom ghc> <optional component name>
stack path --ghc-package-path
Maybe one of these commands fails if packages is missing?
I thought this might be a good issue for me but got hung up on a hie-bios dependency over here. I may be yak-shaving for a while before I can look further into this.
Most helpful comment
Your
stack.yamlshould have a packages field, I believe that's what the parse error is coming from: