tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
950 stars 83 forks source link

Unparseable output with `\cases` and multiple patterns across multiple lines #1025

Closed amesgen closed 1 year ago

amesgen commented 1 year ago

Describe the bug With --unsafe, this snippet (typechecks fine)

foo = \cases
  True
   True -> True
  _ _ -> False

is formatted to

foo = \cases
  True
  True -> True
  _ _ -> False

which fails to parse with

<input>:3:3
  Parsing of formatted code failed:
  [GHC-58481] parse error (possibly incorrect indentation or mismatched brackets)

Expected behavior It should be formatted correctly, using identation for subsequent patterns:

foo = \cases
  True
    True -> True
  _ _ -> False

Environment Happens using Ormolu 0.6.0.1 and current master (8f2bc367051481ee63c47da7745572a351ba3730)