Skip to content

parse error on input -> for a case expression in a multi-statement do expression #1180

@skr2005

Description

@skr2005

To Reproduce
I tried to format this code on https://ormolu-live.tweag.io/:

doGuessing :: (Ord t, Read t) => t -> IO ()
doGuessing num = do {putStrLn "Enter your guess:"; guess <- getLine; case compare (read guess) num of {LT -> do {putStrLn "Too low!"; doGuessing num}; GT -> do { putStrLn "Too high!"; doGuessing num}; EQ -> putStrLn "You win!"}}

... and I got this error:

<input>:2:151-152
  Parsing of formatted code failed:
  [GHC-58481] parse error on input `->'

Expected behavior
I expected that the one-line code would be expanded correctly.

Environment
Ormolu Live
Version 0.8.0.2, commit 0395207, using ghc-lib-parser 9.12.1.20250105

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions