Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a note for contributors installing fourmolu #10473

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,46 @@ of their patch is not influenced by their setup or implicit knowledge of the sys

## Code Style

We use automated formatting with Fourmolu to enforce a unified style across the code bases. It is checked in the CI process.
After installing Fourmolu 0.12, there are some makefile targets to help formatting
the code base.

We use automated formatting, checked in the CI process, to enforce a unified
style across the code bases and include these makefile targets to help with
formatting:

* `make style` - Format the `Cabal`, `Cabal-syntax` and `cabal-install` directories.
* `make style-modified` - Format files modified in the current tree.
* `make style-commit COMMIT=<ref>` - Format files modified between HEAD and the given reference.

> [!NOTE]
> We use `fourmolu-0.12.0.0` for formatting. If installing it with `cabal
> install`, please make sure to use a version of `GHC >= 9.2.1 && < 9.8`.
> Its requirement of `GHC2021` sets the lower bound, and its reliance on
> `ghc-lib-parser` sets the upper bound on GHC versions. A command for
> installing it this way is:
>
> ```
> $ cabal install fourmolu-0.12.0.0 --overwrite-policy=always --ignore-project
philderbeast marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A different worry here is that people may have other versions of fourmolu installed, and may need them for other projects. Sadly, there is no good solution to this at present.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With already having installed fourmolu once before, reinstalling is much quicker, isn't it? For me, this seems to be almost instant and, I would guess, only involves resetting the symlink, doesn't it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's nothing more to add to the contributing docs about this, is there?

> ```

philderbeast marked this conversation as resolved.
Show resolved Hide resolved
> [!Tip]
> If you have multiple versions of GHC installed with `ghcup`, a series-specific
> GHC can be used by adding an option of `--with-compiler=ghc-x.y` (for the
> latest installed `x.y.z` version in the `x.y` series) or an option of
> `--with-compiler=ghc-x.y.z` to the above install command.
>
> ```
> $ ghc --numeric-version
> 9.10.1
>
> $ ghc-9.6 --numeric-version
> 9.6.6
>
> $ ghc-9.4.8 --numeric-version
> 9.4.8
> ```
>
> If not using the `--with-compiler` option then the system `ghc` version should
> be one in the `ghc-9.2`, `ghc-9.4` or `ghc-9.6` series when installing
> `fourmolu`.

## Whitespace Conventions

We use automated whitespace convention checking. Violations can be fixed by
Expand Down
Loading