Skip to content

brittany as invoked by haskell-language-server doesn't match local machine, formats badly #1533

Closed
@jlebar

Description

@jlebar

I am finding that vscode-hie-server is formatting my code differently than when I invoke brittany locally.

Here's me invoking it locally:

$ brittany --version
brittany version 0.12.1.1
[snip]

$ brittany test.hs
f :: [String] -> Int
f (nm : cats : edges) =
  let edges' =
          map ((\[a, b] -> (a, [b])) . (map read . words)) edges :: [(Int, [Int])]
  in  0

In contrast, when I format from the command palette, I get something way worse:

f :: [String] -> Int
f (nm : cats : edges) =
    let edges' =
                map ((\[a, b] -> (a, [b])) . (map read . words)) edges :: [ ( Int
                      , [Int]
                      )
                    ]
    in  0

I am not sure what's going wrong here. Is vscode-hie-server invoking a rogue version of brittany on my machine? Could be. I tried all of the brittany binaries in ~/.stack and they had the first formatting, find ~/.stack -name brittany | xargs -n1 -I{} sh -c '{} test.hs'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: formattersstatus: needs infoNot actionable, because there's missing informationtype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions