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

Support hie-bios #178

Open
hyperfekt opened this issue Feb 9, 2020 · 4 comments · May be fixed by #199
Open

Support hie-bios #178

hyperfekt opened this issue Feb 9, 2020 · 4 comments · May be fixed by #199

Comments

@hyperfekt
Copy link
Contributor

For easy use with hie and ghcide, it would be great if snack added support for hie-bios. My understanding is that for this it needs to be able to output the options given to GHC into a file given by $HIE_BIOS_OUTPUT.

@nmattia
Copy link
Owner

nmattia commented Feb 28, 2020

@hyperfekt apologies about the delay, I was pretty busy!

You mean that snack should read $HIE_BIOS_OUTPUT and write all options given to GHC? You mean build options, correct? I'm guessing that would be these:

snack/snack-lib/build.nix

Lines 148 to 150 in b6ca287

ghc -tmpdir tmp/ ${moduleToFile modSpec.moduleName} -c \
-outputdir $out \
${ghcOptsArgs} \
. That should be doable, we just need snack-the-executable to read the GHC options. Does that include options like -outputdir? Because those are only known at compile time (e.g. inside the derivation). We could potentially log them, and have snack-the-executable parse them.

@hyperfekt
Copy link
Contributor Author

I don't understand a lot about the Haskell build process, but I'm pretty sure the output directory isn't needed since the users of hie-bios are not responsible for compiling. I tried seeing what kind of flags stack gives to hie-bios but wasn't successful so far.

@hyperfekt
Copy link
Contributor Author

Okay, I think I figured it out. hie-bios needs the following in the file located at $HIE_BIOS_OUTPUT:

-no-global-package-db
-package-db [the libdir of the current ghc]/package.conf.d
[all the ghcopts & extensions, one flag per line]

The stuff we need is already used by the library.
It would probably be good to have the snack executable either do the whole job or at least output the bracketed parts, since the location of the snack library takes some logic to figure out that already exists there in the executable.

@hyperfekt
Copy link
Contributor Author

hyperfekt commented May 7, 2020

I'm close to being done implementing this, but since I'm not super familiar with how Haskell builds work I am wondering whether there can exist conflicting in-project dependencies (as opposed to external package ones) in one project, or if we can make ghcide et al use a shared session including all dependencies of the top-level package specification for all files.

EDIT: I just realized the ghci mode would have the same problem so I'm just going to ignore that possibility for now.

@hyperfekt hyperfekt linked a pull request May 7, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants