[GHC] #14550: Report the provenance of TyThings

GHC ghc-devs at haskell.org
Fri Dec 1 13:59:49 UTC 2017


#14550: Report the provenance of TyThings
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:  (none)
               Type:  task           |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 One thing we are slightly nervous about regarding our resolution to #14396
 is whether or not there will be a difficult to understand bug stemming
 from the fact that we may silently pick up an hs-boot TyThing, depending
 on when you do a lookup. You may be able to find the information by
 printing the TyThing with pprTyThing, but nothing is going to tell you, in
 the face, "Hey! This came from a boot file!"

 So, simonpj suggested that we extend the TyThing pretty-printer to say
 where a TyThing came from. This is a good question. The big question:
 where will we put the provenance? There are two possibilities:

 1. Add a field in each constructor TyThing recording the provenance (this
 feels like a disruptive to an otherwise very simple union)
 2. Add a field to each of the constructors Id, ConLike, TyCon, CoAxiom
 (this involves a lot more typing, but these constructors already have lots
 of fields so it's not as disruptive)

 The provenance will, for now, look something like:

 {{{
 newtype TyThingSrc = TyThingSrc {
   tyThingFromBoot :: Bool
   }
 }}}

 and then `TcIface` will be extended to know if we're in boot and will fill
 things in accordingly.

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


More information about the ghc-tickets mailing list