[GHC] #11970: Simplify Parent for patten synonyms

GHC ghc-devs at haskell.org
Thu Apr 28 16:39:03 UTC 2016


#11970: Simplify Parent for patten synonyms
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  mpickering
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mpickering):

 Firstly, Simon and I talked this morning about this and he suggested my
 problem was because the constructor names were in the wrong namespace. His
 hunch was correct.

 However, there is an unforseen problem with this approach.

 Say that both modules `M` and `N` export symbols which have the same name,
 if one of them is a record selector and we try and export it with its
 parent then we can an ambiguous name warning.

 Concretely

 {{{
 module M where

 data T = T { f :: Int }
 }}}

 {{{
 module N where

 f = "f"
 }}}

 {{{
 module Foo (T(f)) where


 import M
 import N
 }}}

 In this example, `f` is looked up but it is ambiguous whether it should be
 `N.f` or `M.T.f`.

 This currently works because renaming for children in export lists is a
 bit weird and converts the RdrNames to FastStrings and only checks that
 they are indeed children of the parent without using any of the `lookup*`
 functions.

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


More information about the ghc-tickets mailing list