google / google/haskell-indexer

Extraction: where to put generated or setup code

Open
#44 0 comments 0 reactions 0 assignees View on GitHub
unclear
Dominant language
Haskell
Stars
103
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Spotted by @MaskRay:

> Sometimes $PWD is not something like ...../mtl-2.2.1 ($package-$version)

![](https://ibin.co/3S3HwiwWMDRy.jpg)

Currently the Stack GHC wrapper script prepends the package name to the generated filepaths (see `wrappers/stack/ghc`), and also assumes that the files passed in to the compiler command are relative to the current dir (which is usually the case, thus the removal of the `./` prefix in the script).

But maybe sometimes the paths are absolute (like pointing to `/home/user/.stack/setup-exe-src/....hs` or `/tmp/setup-xyz/Setup.lhs`).

Now we seems to stash these files as relative under the package dir. Which is not too bad, at least they are bundled with the related package. But if these files would be shared/reused between compiling packages, the duplication would be awkward (does that ever happen?)

Just mentioning that the Kythe frontend at least provides the notion of 'root' which we don't use now. Using roots one could segregate (or namespace) paths, which is useful if independent paths have chance to collide inside a single corpora, or if generated files should be explicitly separated.

I'm not sure it's our task to solve this "once and for all" (forall?), but could provide some path rewrite rules facility, and let various build systems set up the rewrite rules as appropriate for them.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.