Interesting reduction not caught by hlint.
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 1.6k
- Forks
- 210
- PR merge metrics
- No merged PRs in 30d
Description
So I have this function:
-- "Dual" of map, takes an object and a list of functions
-- and applies the object to each function in the list.
pam :: a -> [a -> b] -> [b]
pam a (f:fs) = f a : pam a fs
pam a [] = []
I was able to reduce it to:
pam :: a -> [a -> b] -> [b]
pam a = map (\f -> f a)
Sadly hlint didn't catch this reduction(Although it's able to catch a whole bunch of other reductions in my code any other day!), maybe this might lighten the way for a whole set of new reductions? Thanks for the awesome tool!
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 running HLint on the issue's pam definition and checking existing reduction suggestions for similar higher-order patterns. Trace the implementation and tests for those suggestions; done means HLint reports the equivalent map (\f -> f a) reduction for this example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100