[GHC] #1480: Template Haskell should allow reification of modules

GHC ghc-devs at haskell.org
Wed Oct 30 08:43:14 UTC 2013


#1480: Template Haskell should allow reification of modules
----------------------------+----------------------------------------------
        Reporter:  igloo    |            Owner:
            Type:  feature  |           Status:  patch
  request                   |        Milestone:  7.8.1
        Priority:  high     |          Version:  7.7
       Component:           |         Keywords:
  Template Haskell          |     Architecture:  Unknown/Multiple
      Resolution:           |       Difficulty:  Moderate (less than a day)
Operating System:           |       Blocked By:
  Unknown/Multiple          |  Related Tickets:
 Type of failure:           |
  None/Unknown              |
       Test Case:           |
        Blocking:  8398     |
----------------------------+----------------------------------------------

Comment (by simonpj):

 OK, I'm happy with API, but not so happy with the implementation (though
 it may do for now). The issue is this: the mi_usages field of the
 `ModIface` refers to each module that contains the definition of something
 that is used in this module. Suppose I have
 {{{
         module M where
           import Big
           f = p

         module Big where
           import P( p )
           import Q( q )
 }}}
 Then the `mi_usages` field of M will have an entry for P, but not Q, since
 Q.q isn't referred to in M.  (I think this is right, but the comments need
 improving.)

 What you really want here is a single list of the '''direct''' imports, so
 that you can walk the direct-import tree, isn't it?

 Currently you are going to get more then you want (because you'll get not
 only the direct imports, but more besides); and perhaps less than you want
 (because Q may not have an entry).

 I don't think the direct-import information is recorded as-such in the
 `ModIface` currently, but it easily could be.

 I suppose we could commit the patch as-is (ie perhaps buggy in corner
 cases), but I want to be sure that you were going to push thorough the
 Right Thing in due course.  As part of that, we need more precise
 commentary on the fields of `HscTypes.Dependencies`,
 `TcRnTypes.ImportAvails`, and `mi_usages` of `ModIface`.  For example, I
 wonder whether the `mi_usages` field could be part of the `Dependencies`
 record.  I can help with working this out.

 Simon

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


More information about the ghc-tickets mailing list