Ask questionsLayout is sometimes indented less than the line of the layout trigger

Ormolu currently formats this way:

foo | x <-
        5 = case x of
  5 -> True
  _ -> False

The combination of the extra indent from wrapping the guard, and the case layout to the left of that indent, is very difficult to read. Lots of options would be better, including:

  1. Always Indenting a layout context at least as far as the indent on the line where the layout trigger occurs.
  2. Insisting on a newline after the =, so that this doesn't arise in the first place.

I don't have strong preference between the two, but the current behavior was a real WTF moment.


Answer questions cdsmith

I don't recall the exact original input. Obviously x was a much longer pattern (hence the newline), and the case branches were indented further. Something like this:

foo | Some (Really Long (Pattern x) Goes Here) <-
      someOther really long expression goes here = case x of
        5 -> True
        _ -> False

Related questions

No questions were found.
Github User Rank List