1
1
mirror of https://github.com/tweag/ormolu.git synced 2024-10-26 23:41:47 +03:00

Add fixity troubleshooting in README

This commit is contained in:
Brandon Chinn 2023-09-10 21:21:59 -07:00 committed by Mark Karpov
parent 0d060c0cea
commit 6e5c77ae68

View File

@ -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)
@ -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 the fixity of operators if you use `--debug`.
## Limitations
* CPP support is experimental. CPP is virtually impossible to handle