[GHC] #8441: Allow family instances in an hs-boot file

GHC ghc-devs at haskell.org
Mon Jun 30 09:47:00 UTC 2014


#8441: Allow family instances in an hs-boot file
-------------------------------------+------------------------------------
        Reporter:  goldfire          |            Owner:
            Type:  feature request   |           Status:  new
        Priority:  low               |        Milestone:
       Component:  Compiler          |          Version:  7.7
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by ezyang):

 There is an oblique comment from chak in
 2a8cdc3aee5997374273e27365f92c161aca8453 about the issue here:

 {{{
                 -- Check for no family instances
         ; unless (null boot_fam_insts) $
             panic ("TcRnDriver.checkHiBootIface: Cannot handle family " ++
                    "instances in boot files yet...")
             -- FIXME: Why?  The actual comparison is not hard, but what
 would
             --        be the equivalent to the dfun bindings returned for
 class
             --        instances?  We can't easily equate tycons...
 }}}

 In the case of type class instances, a boot interface may export a number
 of dictionary functions which the source file we're currently typechecking
 may have references to. The names of these dictionary functions are not
 canonical, so unlike normal exported identifiers, we can't simply take an
 identifier from the boot file and hope it will point to the right place.
 Instead, what hi-boot checking currently does is add a pile of dfun
 bindings to the source being typechecked, rewriting all of the booted
 dictionary functions to the appropriate places.

 In the case of type/data families, the comment seems to reason as follows:
 instead of dictionary functions, the boot interface exports a file of type
 functions. However, these need to be equated with the real versions in the
 hs file. And then the comment claims we cannot easily equate tycons.

 One thing to note is that while the rewriting is necessary for recursive
 modules, it's unnecessary if we're just interested in comparing two hi
 files.

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


More information about the ghc-tickets mailing list