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

Error about Data.Record.Generic when only large-records dependency is specified #161

Open
parsonsmatt opened this issue Oct 8, 2024 · 0 comments

Comments

@parsonsmatt
Copy link

I added a dependency on large-records-0.4.1 and added the incantation from the docs to my module.

{-# OPTIONS_GHC -fplugin=Data.Record.Plugin #-}

{-# ANN type PerksSecrets largeRecord #-}
data PerksSecrets = PerksSecrets
  { ...
  -- 300 lines of record fields omitted
  }

I then get an error when trying to load the module in GHCi:

• Reloading ghci:
  • src/Handler/Perks/Types.hs

[2 of 2] Compiling Handler.Perks.Types ( src/Handler/Perks/Types.hs, interpreted ) [So
urce file changed]

<no location info>: error:
Failed, one module loaded.
    lookupName: could not find Generic in module Data.Record.Generic. This might be due to an undeclared package dependency on large-generics.
CallStack (from HasCallStack):
  error, called at src/Data/Record/Internal/GHC/Shim.hs:210:23 in large-records-0.4.1-EVeX1bYy7hr25mSqLxjile:Data.Record.Internal.GHC.Shim
  lookupOccName, called at src/Data/Record/Internal/GHC/Shim.hs:189:25 in large-records-0.4.1-EVeX1bYy7hr25mSqLxjile:Data.Record.Internal.GHC.Shim
  lookupTcName, called at src/Data/Record/Internal/Plugin/Names.hs:130:38 in large-records-0.4.1-EVeX1bYy7hr25mSqLxjile:Data.Record.Internal.Plugin.Names

If I add the dependency to large-generics, then I get another error, this time about record-hasfield:

<no location info>: error:
Failed, one module loaded.
    lookupName: could not find HasField in module GHC.Records.Compat. This might be du
e to an undeclared package dependency on record-hasfield.
CallStack (from HasCallStack):
  error, called at src/Data/Record/Internal/GHC/Shim.hs:210:23 in large-records-0.4.1-
EVeX1bYy7hr25mSqLxjile:Data.Record.Internal.GHC.Shim
  lookupOccName, called at src/Data/Record/Internal/GHC/Shim.hs:189:25 in large-record
s-0.4.1-EVeX1bYy7hr25mSqLxjile:Data.Record.Internal.GHC.Shim
  lookupTcName, called at src/Data/Record/Internal/Plugin/Names.hs:167:32 in large-rec
ords-0.4.1-EVeX1bYy7hr25mSqLxjile:Data.Record.Internal.Plugin.Names

I feel like something is going wrong here - either I've done goofed or GHC is having a bad time. We are using GHC 9.6.3 with some patches that are probably unrelated.

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

No branches or pull requests

1 participant