Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unused imports warning #257

Open
adithyaov opened this issue Feb 10, 2020 · 3 comments
Open

Fix unused imports warning #257

adithyaov opened this issue Feb 10, 2020 · 3 comments

Comments

@adithyaov
Copy link

This is not a major problem but ideally, it's good to fix all the warnings.
We can come up with a protocol to deal with it.

For example, In Data.Primitive.Array the conditionals are as follows,

-- base <  4.8.0  then import Data.Traversable (Traversable(..))
-- base <  4.8.0  then import Data.Monoid
-- base <  4.10.0 then import GHC.Base (runRW#)

-- base >= 4.4.0  then import Control.Monad.Zip
-- base >= 4.7.0  then import GHC.Exts hiding (toList)
-- base >= 4.7.0  then import GHC.Exts (fromListN, fromList)
-- base >= 4.8.0  then import Data.Functor.Identity
-- base >= 4.9.0  then import qualified GHC.ST as GHCST
-- base >= 4.9.0  then import qualified Data.Foldable as F
-- base >= 4.9.0  then import Data.Semigroup
-- base >= 4.10.0 then import GHC.Exts (runRW#)

-- base >= 4.9.0 || transformers >= 0.4.0
--                then import Data.Functor.Classes (Eq1(..),Ord1(..),Show1(..),Read1(..))

It would be nice to come up with a proper method for writing imports so that it is minimally complete. We should make sure not to import any additional modules or reimport the same module in multiple conditionals.

This is a general problem but fixing it in this library would be a good start.

We should probably try to maximize the use of qualified imports.

@cartazio
Copy link
Contributor

cartazio commented Feb 10, 2020 via email

@cartazio
Copy link
Contributor

cartazio commented Feb 10, 2020 via email

@adithyaov
Copy link
Author

adithyaov commented Feb 10, 2020

Out of curiosity, how did you run afoul if those warnings?

I've currently used a few files in this library to fix a few version bounds for my project. The CI that my project is on fails even if there are warnings (-Werror). We ideally like to eliminate all the warnings as well.

I've managed to fix the warnings in PrimArray and SmallArray but what I did is more like a hack than a proper protocol.

In this case what makes you favor converting those imports to qualified
ones ?

I've not entirely thought this through, but I'll come up with a proper example with some modules in this library and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants