[GHC] #14629: Seemingly unused qualified import affects method visibility

GHC ghc-devs at haskell.org
Wed Jan 3 09:23:37 UTC 2018


#14629: Seemingly unused qualified import affects method visibility
-------------------------------------+-------------------------------------
        Reporter:  gelisam           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  ticket:3992,      |  Differential Rev(s):
  ticket:10890                       |
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 The logic is this:

 * If you export (or re-export) a class without one or more of its methods,
 you are trying to hide the very existence of that method in the class, so
 no client should be able to give an implementation for it.

 * But if you export it (even if only qualified) you are exposing it, so an
 instance can use it.

 * It would obviously be very tiresome to say that a method must be in
 scope ''unqualified'' in order to use it in an instance declaration. So
 the test is "is the method in scope, qualified or unqualified"

 I think this logic makes sense.  I thought it was in the Haskell Report
 but I can't find it.

 I agree, though, that allowing qualified names on the LHS of an instance
 decl would make perfect sense.  It'd be easy to implement too.  Volunteers
 welcome.  (A short GHC proposal would be kosher.)

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


More information about the ghc-tickets mailing list