Suggestion to replace intercalate " " by unwords when I have my own intercalate
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=396:
Given
> module Delme (bob) where
>
> intercalate :: String -> [String] -> String
> intercalate = undefined
>
> bob :: [String] -> String
> bob = intercalate " "
hlint suggests
Delme.lhs:9:9: Error: Use unwords
Found:
intercalate " "
Why not:
unwords
Can hlint recognize that intercalate is not the expected one for this suggestion and so not fire the rule? Presumably this also holds for other transformations?
In the actual code base the signature of intercalate is MBuilder -> [MBuilder] -> MBuilder but I wanted to simplify things for the example.
@ndmitchell replied:
Yes, HLint 1.8 gained the ability to recognise modules, so I should be able to say Data.List.intercalate " " => unwords, and then the replacement won't match for your example. I'll go through and do this for all hints.
In fact, I should have import Data.List(intercalate) in the hint list, which makes the imports accurate and checkable, but keeps the hints readable.
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 example with a locally defined intercalate and compare it with a Data.List.intercalate import. Inspect HLint's hint definitions and module-aware matching. Done means the unwords hint applies to Data.List.intercalate but not to unrelated functions, with the affected hints remaining import-accurate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100