Skip to content

Improvement of operator chain handling #826

@tbagrel1

Description

@tbagrel1

At the point where Ormolu works, operator fixities and precedence levels are not known, so the operator call trees (OpApp) in the AST might not match the actual order of operations. Currently, we do some "educated guesswork" to reform the ordered binary call tree, and special-case the formatting of some specific operators (:, $).

As an attempt to improve the operator chain formatting, I propose new areas of work:

  • Extracting operator fixity/precedence information from Hoogle or Hackage, to improve heuristics of the formatter, and to be able to "display" the actual call tree using indents in the formatted output
  • Transforming operator call trees from binary trees to n-ary trees, where every operator with the same precedence level is located at the same level in the tree

A PoC is in progress :)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions