#4491: dataToQa uses only unqualified names when converting values to their TH
representation.
---------------------------------+------------------------------------------
    Reporter:  gmainland         |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  Template Haskell  |      Version:  6.12.3      
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by gmainland):

 Sorry for the muddled terminology. When I wrote "resolved module name" I
 meant the `moduleName` of the `Module` component of the `NameSort` of a
 `Name` (whew...). An "unresolved module name" would be the `ModuleName`
 component of a qualified `RdrName`. Perhaps "renamed module name" and
 "qualifier" are better terms? What is the correct terminology?

 Given an `x` that is an instance of `Data`, `(showConstr . toConstr) x` is
 the (unqualified) name of the data constructor used to construct x and
 `(tyconModule . dataTypeName . dataTypeOf) x` is the name of the module in
 which the corresponding type constructor is defined. Both are (newtype'd)
 strings. I would like to use these to get Template Haskell to create an
 original name, not a qualified name. The module defining the constructor
 may not be in scope, or it could be in scope but aliased due to an "as"
 import, so creating a qualified name is not the right thing to do.

 Two things that might get us where I want to be:

  1. Add a constructor to `Language.Haskell.TH.Syntax.NameFlavour`, `NameO
 ModName`, that represents an original name.

  2. In GHC, have a way to convert a `ModuleName` to a `Module`, i.e., find
 the package that defines the `ModuleName`.

 Then when converting TH, GHC could apply (2) to (1) and use the `Orig`
 data constructor to create a `RdrName`.

 Wired-in names would still have to be handled separately (the attached
 patch does this more-or-less correctly, I think).

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4491#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to