How to make HLS find Paths_proj module?

When writing a command line tool in Haskell I like to add support for printing the version as defined in the Cabal file. For this I import the generated Paths_proj module:

import Paths_proj (version)

cabal build has no problems with this, but HLS tells me (in my editor) that

 Main.hs    22   1 error           Could not find module ‘Paths_proj’
                                   Use -v (or `:set -v` in ghci) to see a list of the files searched for. (haskell-ghc)

What setup/config am I missing?

Did you add it to your cabal file?

Usually:

  other-modules:      Paths_proj
  autogen-modules:    Paths_proj

I had the first, as cabal build complains otherwise. I didn’t know about the second.

However, the error remains… after thinking a bit more about it I’m not sure it is HLS complaining at all :man_facepalming: