From 170f9b89d2ba5c54544fefbb9632db048b01694c Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Sun, 10 Sep 2023 21:21:59 -0700 Subject: [PATCH] Add fixity troubleshooting in README --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 178efd99..53376734 100644 --- a/README.md +++ b/README.md @@ -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 fixity of operators if you use `--debug`. + ## Limitations * CPP support is experimental. CPP is virtually impossible to handle