haskell / alex

A lexical analyser generator for Haskell
https://hackage.haskell.org/package/alex
BSD 3-Clause "New" or "Revised" License
297 stars 82 forks source link

The import of ‘Control.Applicative’ is redundant - when using GHC 7.10 #70

Closed nikomi closed 4 years ago

nikomi commented 9 years ago

Maybe this has already been solved but not yet found its way to hackage:

When compiling modules created by Alex 3.1.4 with GHC 7.10.2 the following warning comes up:

templates/wrappers.hs:7:1: Warning:
    The import of ‘Control.Applicative’ is redundant
      except perhaps to import instances from ‘Control.Applicative’
    To import instances alone, use: import Control.Applicative()

I'm using Alex 3.1.4 - the newest I could find on hackage:

$ alex --version
Alex version 3.1.4, (c) 2003 Chris Dornan and Simon Marlow

I think this is one of the topics covered in https://ghc.haskell.org/trac/ghc/wiki/Migration/7.10

thx, nikomi

chamini2 commented 9 years ago

I think this is already solved with pull request #69

nikomi commented 9 years ago

Thanx for the info!

Now it's just a matter of time until this will show up on hackage :-)

nikomi commented 8 years ago

Now I'm a bit confused - after reading the change history

Changes in 3.1.5:

Generate less warning-laden code, and suppress other warnings.

I installed the newest Alex 3.1.6

$ alex --version
Alex version 3.1.6, (c) 2003 Chris Dornan and Simon Marlow

and now I see even more warnings:

templates/wrappers.hs:7:1: Warning:
    The import of ‘Control.Applicative’ is redundant
      except perhaps to import instances from ‘Control.Applicative’
    To import instances alone, use: import Control.Applicative()

templates/wrappers.hs:8:1: Warning:
    The qualified import of ‘Control.Monad’ is redundant
      except perhaps to import instances from ‘Control.Monad’
    To import instances alone, use: import Control.Monad()

templates/wrappers.hs:10:1: Warning:
    The import of ‘Data.Int’ is redundant
      except perhaps to import instances from ‘Data.Int’
    To import instances alone, use: import Data.Int()

What am I doing wrong? Did the perhaps the templates get mixed up?

hvr commented 8 years ago

@nikomi can you test whether this has improved with the just released alex-3.1.7?

nikomi commented 8 years ago

It has - only one warning left:

templates/wrappers.hs:9:1: Warning:
    The qualified import of ‘Control.Monad’ is redundant
      except perhaps to import instances from ‘Control.Monad’
    To import instances alone, use: import Control.Monad()
hvr commented 8 years ago

...at least we're getting closer =)

I've some vague plans to improve alex' testsuite to help detect this...

nikomi commented 8 years ago

Great!

Thanx for taking care!

josephcsible commented 5 years ago

@nikomi That should be fixed by #134.

andreasabel commented 4 years ago

Shouldn't this issue be closed?

There are similar problems, of course, on 8.4.4 we get the warning

[ 3 of 22] Compiling Data.Ranged.RangedSet
src/Data/Ranged/RangedSet.hs:31:1: warning: [-Wunused-imports]
    The import of ‘Data.Semigroup’ is redundant
      except perhaps to import instances from ‘Data.Semigroup’
    To import instances alone, use: import Data.Semigroup()
   |
31 | import Data.Semigroup
   | ^^^^^^^^^^^^^^^^^^^^^

but this isn't the original issue.

simonmar commented 4 years ago

It would be good to make Alex -Wall clean, but no need to have this issue I think.