It look like ormolu is making an incorrect assumption about when it's okay to remove braces.
$ ormolu -i (git ls-files '*.hs')
typeclasses-make-timeline/src/Timeline/Read.hs
@@ -181,6 +186,6 @@
fixFragment :: Fragment -> Fragment
fixFragment = coerce $ insertApostrophe . insertEllipsis . insertEmDash
where
- insertApostrophe = Text.map \case{ '\'' -> '’'; x -> x }
- insertEmDash = Text.concat . map \case{ x | x == "--" -> "—"; x -> x } . Text.groupBy ((==) `on` Char.isSpace)
- insertEllipsis = Text.concat . map \case{ x | x == "..." -> "…"; x -> x } . Text.groupBy ((==) `on` (== '.'))
+ insertApostrophe = Text.map \case '\'' -> '’'; x -> x
+ insertEmDash = Text.concat . map \case x | x == "--" -> "—"; x -> x . Text.groupBy ((==) `on` Char.isSpace)
+ insertEllipsis = Text.concat . map \case x | x == "..." -> "…"; x -> x . Text.groupBy ((==) `on` (== '.'))
AST of input and AST of formatted code differ.
at typeclasses-make-timeline/src/Timeline/Read.hs:185:20-74
at typeclasses-make-timeline/src/Timeline/Read.hs:185:78-89
at typeclasses-make-timeline/src/Timeline/Read.hs:185:91-114
at typeclasses-make-timeline/src/Timeline/Read.hs:186:22-77
at typeclasses-make-timeline/src/Timeline/Read.hs:186:81-92
at typeclasses-make-timeline/src/Timeline/Read.hs:186:94-113
Please, consider reporting the bug.
To format anyway, use --unsafe.
$ ormolu --version
ormolu 0.5.0.1 UNKNOWN UNKNOWN
using ghc-lib-parser 9.2.7.20230228
To work around, I can wrap the lambda case expressions in parentheses.
It look like ormolu is making an incorrect assumption about when it's okay to remove braces.
To work around, I can wrap the lambda case expressions in parentheses.