[GHC] #13064: Incorrect redudant imports warning

GHC ghc-devs at haskell.org
Thu Aug 23 10:28:44 UTC 2018


#13064: Incorrect redudant imports warning
-------------------------------------+-------------------------------------
        Reporter:  phadej            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  low               |            Milestone:  8.8.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #15393            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * cc: ekmett@… (added)


Comment:

 I had forgotten all about [wiki:Commentary/Compiler/RelaxedUnusedImports].
 Thanks: you are right to point to it as a possible design.

 We quite often fix a bug that forces libraries to change in some minor
 way; library authors are (perhaps reluctantly) used to this.   In this
 case, the change affects only warnings, perhaps the least bad way to break
 a library.  (Worse ways are: the library is now type incorrect; or (worse
 still) compiles cleanly but gives the wrong answers.)

 I think the awkward thing here is that library authors like to produce an
 updated version of the library that will work with many versions of GHC.
 For that they resort to CPP. Thus in `containers:Data.Map.Internal.hs` we
 see
 {{{
 #if __GLASGOW_HASKELL__ >= 708
 import qualified GHC.Exts as GHCExts
 #endif
 }}}
 The [https://prime.haskell.org/wiki/Libraries/3-Release-Policy three
 release policy says] ''Changes '''to basic libraries''' are planned and
 implemented so that, at any time, it is possible to write code that works
 with the latest three releases of GHC and base, without resorting to CPP,
 and without causing warnings even when compiled with -Wall.''

 Note "to basic libraries".  I don't see how it's possible to apply this
 policy to the compiler itself.  Suppose a library compiles with GHC 12.0,
 and we want to make a change in the warnings the compiler produces.  We
 could defer the change to 12.6; but then the author could just apply the
 policy starting at 12.6, so we'd have to defer to 12.12, and so on.  I
 feel I must be missing something.

 Also as comment:24 points out, there is a non-CPP way to adapt too.

 Let's see what the CLC (cc'd) says. I'm adding Edward to cc as well.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13064#comment:27>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list