primitive
primitive copied to clipboard
Fix unused imports warning
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.
Good point!
On Mon, Feb 10, 2020 at 4:35 AM Adithya Kumar [email protected] wrote:
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.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/haskell/primitive/issues/257?email_source=notifications&email_token=AAABBQU2CGDSAQNKMYR4RG3RCENWFA5CNFSM4KSKTIF2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IMGCHHA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABBQXYIJ3QDP4EPVY2E3LRCENWFANCNFSM4KSKTIFQ .
Out of curiosity, how did you run afoul if those warnings?
It’s moderately challenging to be perfectly warning clean across a large range of supported versions.
In this case what makes you favor converting those imports to qualified ones ?
On Mon, Feb 10, 2020 at 8:39 AM Carter Schonwald [email protected] wrote:
Good point!
On Mon, Feb 10, 2020 at 4:35 AM Adithya Kumar [email protected] wrote:
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.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/haskell/primitive/issues/257?email_source=notifications&email_token=AAABBQU2CGDSAQNKMYR4RG3RCENWFA5CNFSM4KSKTIF2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IMGCHHA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABBQXYIJ3QDP4EPVY2E3LRCENWFANCNFSM4KSKTIFQ .
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.