"Use fewer imports" behaviour does not seem to take into account CPP version bounds.
HLint seems to trip on that piece of code:
import Data.Bits (shiftL, shiftR, (.|.), (.&.))
#if MIN_VERSION_base(4,7,0)
import Data.Bits (finiteBitSize)
#else
import Data.Bits (Bits, bitSize)
finiteBitSize :: (Bits a) => a -> Int
finiteBitSize = bitSize
#endif
libraries/base/GHC/Windows.hs:77:1-47: Warning: Use fewer imports
Found:
import Data.Bits ( shiftL, shiftR, (.|.), (.&.) )
import Data.Bits ( Bits, bitSize )
Perhaps:
import Data.Bits ( shiftL, shiftR, (.|.), (.&.), Bits, bitSize )
Nothing in HLint takes account CPP at all, unfortunately. It just can't see the CPP is even there. With a little hand holding you can encourage it to take one branch or another, but that's the best you can do, unfortunately.
Maybe it's worth detecting CPP in a module, and in that case, disabling the warnings that are most likely to go wrong with CPP - use fewer imports being one.
I am going to put those modules in the exclude list for that hint for the moment. Thank you Neil. :)
Nothing in HLint takes account CPP at all, unfortunately.
Good to know, thanks @ndmitchell. I put this to the test with hlint-3.8 and HLint is not warning when {-# LANGUAGE CPP #-} is an unused language pragma.