Occasionally, applying hlint suggestions doesn't work as expected
See original GitHub issueSince the latest beta (?) applying hlint suggestions doesn’t always work. There are some cases where it does work, and others where the suggestion is inserted without overriding existing code. Here’s a sample:
sample :: [Int] -> (Int -> Int) -> [String]
sample xs f = (show . f) <$> xs
IntelliJ offers me a quick fix saying:
Reudundant bracket, change to
show . f <$> xs
when I apply the fix, I end up with the following:
sample xs f = show . f <$> xs <$> xs
So, it doesn’t override <$> xs
but inserts it (similar to when I press Enter instead of Tab for completion).
My guess is that it is related to when there are a function composition operator and redundant brackets involved, but I’m not sure about that.
I’m on plugin version 1.0.0-beta78, IntellIJ IDEA 2020.2.1 RC (Ultimate Edition) Build #IU-202.6948.36 (I faced the issue with 2020.2 as well)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Can HLint automatically do suggested edits?
Hlint directly calls the executable to apply the suggestions. Note that hlint doesn't apply transformations recursively, so additional ...
Read more >hlint: Source code suggestions
HLint doesn't suggest optimisations, it suggests code improvements - the intention is to make the code simpler, rather than making the code ...
Read more >Refactor program with HLint suggestions
The underlying Haskell parser library makes it hard to modify the code, then print it similarly to the original. Sometimes multiple transformations may...
Read more >HLint: Haskell Source Code Suggestions - Morioh
HLint is a tool for suggesting possible improvements to Haskell code. These suggestions include ideas such as using alternative functions, simplifying code.
Read more >Automatically Apply HLint Suggestions : r/haskell
Does that mean CPP mostly works (by which I mean is reproduced faithfully) with some edge cases that don't, or that it doesn't...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I totally missed the notifications on this issue, sorry for letting you wait! I just downloaded beta85 and tried it. I can tell that it definitely got better. The fixes for my first examples work now (the
sample
function ones). However, the last one is still a bit weird. For this one:I get three suggestions (two redundant brackets and one redundant lambda). The fixes for brackets work, but when I apply the fix for the redundant lambda I get:
Interestingly, the suggestion in the popup is weird already:
I get the same behavior even when I apply the fixes for the brackets first
Investigated this issue and to solve this properly I have to change the integration with HLint. Will take some effort but it’s necessary.