You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
triggersUseMap::Foldablef=>fa-> [a]
triggersUseMap =foldr (\k acc -> identity k : acc) []-- to get rid of "Avoid lambda" and "Redundant id"identity::a->a
identity =id
triggers the hint
Warning: Use map
Found:
foldr (\ k acc -> identity k : acc) []
Perhaps:
map (\ k -> identity k)
but obviously triggersUseMap = map (\k -> identity k) does not compile, since map wants a list and the argument is a general Foldable.
The same warning is not emitted with the eta reduced version:
noHint::Foldablef=>fa-> [a]
noHint =foldr ((:). identity) []-- no hint even with foldr (:) []
This is using GHC 9.6.5 with HLint 3.6.1 (apologies if this was already fixed in 3.8, but I didn't see anything of the sort in the changelog)
The text was updated successfully, but these errors were encountered:
The code
triggers the hint
but obviously
triggersUseMap = map (\k -> identity k)
does not compile, sincemap
wants a list and the argument is a generalFoldable
.The same warning is not emitted with the eta reduced version:
This is using GHC 9.6.5 with HLint 3.6.1 (apologies if this was already fixed in 3.8, but I didn't see anything of the sort in the changelog)
The text was updated successfully, but these errors were encountered: