stylish-haskell
stylish-haskell copied to clipboard
Find options from cabal files based on the location of the input file, not PWD
At the moment, stylish-haskell looks for .cabal files based on the directory where you run the command from, not on where the file itself is.
Why does this matter? In a multi-package project, it's normal to have multiple packages with their own cabal files. You then can't run stylish-haskell from the root (or if you do, you'll get different behaviour). This makes things like find . -name "*.hs" -exec stylish-haskell -i {} \; or even stylish-haskell -i -r . a lot less useful.
(For anyone reading this: find -execdir runs the command in the directory of the file, which is a workaround for this problem.)
It would be nice if we instead looked for a cabal file for each argument file based on its location.