lspitzner / lspitzner/brittany

Configuration option to always hang guards/where

Open
#100 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement layouting
Dominant language
Haskell
Stars
686
Forks
69
PR merge metrics
No merged PRs in 30d

Description

Apologies if this already exists, but I wasn't able to find anything obvious in the docs or code to force guards and where clauses to always be hung on the next line. For example, I'd like code to be formatted as follows:

foo = blah
  where
    intersectBM (Bin p2 m2 l2 r2)
      | nomatch p2 m2 = Nil

Currently after formatting it will look like:

foo = blah where intersectBM (Bin p2 m2 l2 r2) | nomatch p2 m2 = Nil

It appears that if all the guards/where clauses fit without overflowing the column limit then they are aligned on the right. Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the formatter's handling of guards and where clauses, along with its configuration documentation and code. Trace why clauses remain inline when they fit within the column limit. Done means a configuration option forces these clauses onto the next line and the reported example formats as shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.