Matching should see through lambdas at the statement level
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 1.6k
- Forks
- 210
- PR merge metrics
- No merged PRs in 30d
Description
From https://code.google.com/p/ndmitchell/issues/detail?id=471, @tomprince says:
The code
> parensF f = \a b -> parens (f a) (f b)
gives suggestions
> parensF f a b = parens (f a) (f b)
> parens `Data.Function.on` f
but if I apply the first, getting
> parensF f a b = parens (f a) (f b)
it no longer gives me the second suggestion, which would now be
> parensF f = parens `Data.Function.on` f
Clearly both original suggestions are beneficial, but the first one is rather obvious, and likely caught and applied by hand before running hlint. That means that the second suggestion, which teaches the library, won't ever be shown.
@ndmitchell replies:
On further analysis, I think the real fix is that the matcher should be rewritten so that:
foo a b c = ....
Is analysed as:
foo = \a b c -> ...
And then any remaining lambdas are moved back at the end. That makes it a lot more general than just the on suggestion.
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
No source file or test is named. Start by locating the statement-level matcher and reproduce the two parensF examples from the issue. Done means matching analyzes function bindings through their implicit lambdas, while preserving the intended suggestions after remaining lambdas are moved back.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100