Skip to content

Commit

Permalink
Add fixity troubleshooting in README
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 authored and mrkkrp committed Feb 9, 2024
1 parent 0f44a41 commit 170f9b8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* [Regions](#regions)
* [Exit codes](#exit-codes)
* [Using as a library](#using-as-a-library)
* [Troubleshooting](#troubleshooting)
* [Operators are being formatted weirdly!](#operators-are-being-formatted-weirdly)
* [Limitations](#limitations)
* [Running on Hackage](#running-on-hackage)
* [Forks and modifications](#forks-and-modifications)
Expand Down Expand Up @@ -272,6 +274,32 @@ For these purposes only the top `Ormolu` module should be considered stable.
It follows [PVP](https://pvp.haskell.org/) starting from the version
0.5.3.0. Rely on other modules at your own risk.

## Troubleshooting

### Operators are being formatted weirdly!

This can happen when Ormolu doesn't know or can't determine the fixity of an
operator.

* If this is a custom operator, see the instructions in the [Language
extensions, dependencies, and
fixities](#language-extensions-dependencies-and-fixities) section to
specify the correct fixities in a `.ormolu` file.

* If this is a third-party operator (e.g. from `base` or some other package
from Hackage), Ormolu probably doesn't recognize that the operator is the
same as the third-party one.

Some reasons this might be the case:

* You might have a custom Prelude that re-exports things from Prelude
* You might have `-XNoImplicitPrelude` turned on

If any of these are true, make sure to specify the reexports correctly in
a `.ormolu` file.

You can see how Ormolu decides fixity of operators if you use `--debug`.

## Limitations

* CPP support is experimental. CPP is virtually impossible to handle
Expand Down

0 comments on commit 170f9b8

Please sign in to comment.