Question

In the project pandoc, Paths_pandoc is imported in Shared.hs. Paths_pandoc.hs is located in dist/build/autogen/. How is it generated and what does it do for pandoc.

Was it helpful?

Solution

It's a file that is generated by Cabal.

When you specify Data-files: in your .cabal file for your project, those files will be copied to a good location for "data files" on your system when you run cabal install. On Windows, this might be "C:\Program Files\Something" and on Linux it might be "/usr/share/something" (At least when you do a --system install).

Your code needs to know where the files were copied to, so Cabal generates that special module, which contains variables for the install paths that were used to copy the data files, so that your code can find the installed data files.

The module does also contain other information that Cabal provides for you, but the primary purpose of the module is what I just described.

See this blog post for more information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top