tweag/ormolu

Format base infix operators better when cabal file doesn't mention module

brandonchinn178 opened this issue · 0 comments

Describe the bug
If you have a standalone Haskell file in a Cabal project (e.g. a Haskell script), Ormolu will find the cabal file, but it'll see that the cabal file doesn't mention the file and return ciDependencies = [].

To Reproduce
Make a file test.hs with the following contents in a directory containing a .cabal file:

foo =
  unlines $
    hello <> world : ["Line " ++ show x | x <- [10 .. 20]]
  where
    hello = "hello"
    world = " world"

It will reformat as

foo =
  unlines
    $ hello
    <> world
    : ["Line " ++ show x | x <- [10 .. 20]]
  where
    hello = "hello"
    world = " world"

Expected behavior
Formatting a Haskell file with a cabal file that doesn't mention it should be equivalent to formatting without a cabal file

Environment

  • OS name + version:
  • Version of the code: 0.7.0.0

Additional context
Add any other context about the problem here.