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

Document the interaction between Backpack and Template Haskell #7353

Open
danidiaz opened this issue Apr 8, 2021 · 2 comments
Open

Document the interaction between Backpack and Template Haskell #7353

danidiaz opened this issue Apr 8, 2021 · 2 comments

Comments

@danidiaz
Copy link
Collaborator

danidiaz commented Apr 8, 2021

Perhaps the Backpack section of the user guide could devote a paragraph or subsection to explaining the interaction between indefinite libraries and TH code.

I've found that splicing TH code from libraries that are still indefinite (that is: libraries that have module signatures still unfilled) causes errors like

ghc: ^^ Could not load 'lesson9zmtemplatezmhaskellzm1zi0zi0zi0zminplacezmcorezmAfo5JIVDJVcCScFF1FkCSzz_CoreziTH_makeIdFunc_closure', dependency unresolved. See top entry above.
GHC.ByteCode.Linker.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
  lesson9zmtemplatezmhaskellzm1zi0zi0zi0zminplacezmcorezmAfo5JIVDJVcCScFF1FkCSzz_CoreziTH_makeIdFunc_closure

I wrote a longer description of the problem here.

I'm not 100% sure, but the problem might be that indefinite libraries get typecheked, but not compiled down to object code (they can't be, because they have "holes" in the form of module signatures).

Therefore, when splicing the code, there's no actual TH code to run! So this is not a bug, but an insurmountable limitation of Backpack (although the errors could be better).

@fgaz
Copy link
Member

fgaz commented Apr 8, 2021

/cc @ezyang

@ezyang
Copy link
Contributor

ezyang commented Apr 9, 2021

Yes, this diagnosis is absolutely correct. (And the error message could definitely be better, though I'm not sure exactly where to put it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants