(moved from haskell/haskell-language-server#4466)
Behavior summary by stylish-haskell version(s):
- 0.14.6.0 -
Main.hs: <string>:5:6: error: parse error on input :'`
- 0.13.0.0 -
Main.hs: RealSrcSpan SrcSpanOneLine "Main.hs" 5 6 7: parse error on input :'`
- 0.12.0.0 -
Main.hs: RealSrcSpan SrcSpanOneLine "Main.hs" 5 6 7: parse error on input :'`
- 0.11.0.0 -
Language.Haskell.Stylish.Parse.parseModule: could not parse Main.hs: ParseFailed (SrcLoc "<unknown>.hs" 5 6) "Parse error: :"
- 0.10.0.0 - Successful parse and formatting!
Steps to reproduce
Format
Main.hs:
main = pure ()
data MyRecord = MyRecord
{ ab :: Int
, c:: Int
}
with stylish-haskell Main.hs
Important pieces here:
c:: Int <- no space between field name and ::. This makes the formatting fail.
ab field name is longer than c field name. This makes the error show up in the LSP log. If the fields are the same length no error appears, but the formatting still fails to apply. Weird!
Expected behaviour
Since this code compiles with ghc Main.hs I would expect it to be formatted with stylish-haskell Main.hs
(moved from haskell/haskell-language-server#4466)
Behavior summary by stylish-haskell version(s):
Main.hs: <string>:5:6: error: parse error on input:'`Main.hs: RealSrcSpan SrcSpanOneLine "Main.hs" 5 6 7: parse error on input:'`Main.hs: RealSrcSpan SrcSpanOneLine "Main.hs" 5 6 7: parse error on input:'`Language.Haskell.Stylish.Parse.parseModule: could not parse Main.hs: ParseFailed (SrcLoc "<unknown>.hs" 5 6) "Parse error: :"Steps to reproduce
Format
Main.hs:with
stylish-haskell Main.hsImportant pieces here:
c:: Int<- no space between field name and::. This makes the formatting fail.abfield name is longer thancfield name. This makes the error show up in the LSP log. If the fields are the same length no error appears, but the formatting still fails to apply. Weird!Expected behaviour
Since this code compiles with
ghc Main.hsI would expect it to be formatted withstylish-haskell Main.hs