lspitzner / lspitzner/brittany
Operator precedence sensitive layout
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 686
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
Consider the following piece of code as formatted by britanny:
dP =
string "ne"
$> NE
<|> string "nw"
$> NW
<|> string "n"
$> N
<|> string "se"
$> SE
<|> string "sw"
$> SW
<|> string "s"
$> S
This doesn't reflect the precedence of the operators involved very well and also makes the meaning less clear.
I would expect it to be formatted as such:
dP =
string "ne" $> NE
<|> string "nw" $> NW
<|> string "n" $> N
<|> string "se" $> SE
<|> string "sw" $> SW
<|> string "s" $> S
And I am sure there are other cases where long expressions with different operators could be layed out better if precedence was taken into account.
Is this something brittany can do?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Haskell example in the issue and locate brittany's layout handling for long expressions with mixed operators. Compare the current output with the expected grouping, then verify the formatter preserves operator precedence across additional mixed-precedence cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100