-
Notifications
You must be signed in to change notification settings - Fork 81
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
bazel-runfiles package doesn’t return results correctly when invoked from Template Haskell #1337
Comments
This is an interesting use-case. With
The runfiles mechanism as it is currently implemented does not work for template Haskell at compile time. As you point out An idea that has been floating around is to have a separate attribute for template Haskell dependencies However, given the current state, I would recommend |
Using the preprocessor trick worked great! I think a |
I'm glad to hear it 🎉
I've opened a tracking issue in #1382. |
I think we can close this in favor of #1382! |
Describe the bug
I’m trying to build some source that accesses filesystem locations and generates code based on these files. (Gnarly, I know.) I ran into #1246, which interfered with our approach up until now (using cabal’s
data-files
), so I thought I’d try thehaskell_library
function’sdata
field, accessing the paths with thebazel-runfiles
package. Unfortunately, though this works inside REPLs and executables, it doesn’t appear to work from Template Haskell splices. The call togetExecutableName
here returns the path to the relevantghc
executable, which interferes when lookup up runfiles and their manifests.To Reproduce
Call
Runfiles.rlocation
from a Template Haskell splice and observe the resulting error message.Expected behavior
A clear and concise description of what you expected to happen.
Environment
Additional context
I’m probably going to work around this with
file-embed
for the time being, but I figured I’d file it for posterity.The text was updated successfully, but these errors were encountered: