ghc-mod
ghc-mod copied to clipboard
Support the STACK_YAML environment variable (or add --stack-yaml)
Stack allows you to specify an alternate location for the stack.yaml file using the --stack-yaml command line option or the STACK_YAML environment variable. I don't like to clutter up the root directory of my repositories so I store my stack.yaml files in a build directory.
ghc-mod should allow you to specify an alternate location for the stack.yaml file using either a new command line option or by respecting the STACK_YAML environment variable.
It's actually recommended in the stack documentation to have multiple YAML files if you want to support multiple resolvers. This would be another motivation for supporting alternate stack configuration files in ghc-mod.
This should be very easy to add. Here is the code that looks for stack.yaml: https://github.com/DanielG/ghc-mod/blob/19b3de356928f7c1a7aa3a59430beae08a883e7b/Language/Haskell/GhcMod/PathsAndFiles.hs#L75
The path isn't used anywhere we only use this to check for it's existence and invoke stack directly for everything else. So all you need to do is insert the appropriate logic there and it should work.
PR forthcoming.