axellang / axel

Haskell + Lisp
https://axellang.github.io
BSD 3-Clause "New" or "Revised" License
206 stars 9 forks source link

Autogenerated imports create a lot of unused import warnings #55

Open jgrosso opened 5 years ago

jgrosso commented 5 years ago

The user shouldn't be bothered by the warnings of the form:

<file path>: warning: [-Wunused-imports]
    The qualified import of ‘Prelude’ is redundant
      except perhaps to import instances from ‘Prelude’
    To import instances alone, use: import Prelude()
  |
2 | import qualified Prelude as GHCPrelude
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

<file path>:3:1: warning: [-Wunused-imports]
    The qualified import of ‘Axel.Parse.AST’ is redundant
      except perhaps to import instances from ‘Axel.Parse.AST’
    To import instances alone, use: import Axel.Parse.AST()
  |
3 | import qualified Axel.Parse.AST as AST
  | ^^

These modules are auto-imported by Axel, and thus the user has no way to fix the warnings anyway.

Two potential solutions are: 1) Filter such warnings out of GHC-generated output. Easier(?), but hackier. 2) Avoid auto-importing these modules if they're not actually used in the files in question (e.g. there are no quotations in the file).