ndmitchell / ndmitchell/hlint

Fire a rule when it wouldn't add parentheses

Open
#702 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
1.6k
Forks
210
PR merge metrics
No merged PRs in 30d

Description

I'd like to write a rule that transforms fmap to <$> to remove parentheses. To prevent nuisance firings, I'd like it to not fire when parentheses would still be required on the RHS. For example, I want fmap f (x:xs) to be transformed to f <$> x:xs, but I don't want fmap f (x $! y) to be transformed to f <$> (x $! y). Is there some condition I can put in side for this? If such a thing doesn't currently exist, can it be added?

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 tracing how HLint evaluates rule conditions in side and how it determines whether the rewritten RHS needs parentheses. Use the fmap examples as the expected behavior: allow the transformation for (x:xs), but retain parentheses for (x $! y).

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.