[GHC] #9562: Type families + hs-boot files = unsafeCoerce

GHC ghc-devs at haskell.org
Thu Jan 12 11:10:42 UTC 2017


#9562: Type families + hs-boot files = unsafeCoerce
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  ezyang
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  Compiler          |              Version:  7.8.3
      Resolution:                    |             Keywords:  TypeFamilies,
                                     |  SafeHaskell hs-boot
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC accepts       |  Unknown/Multiple
  invalid program                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #10270            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 With the caveat that I don't feel like I fully grok type checking in the
 middle of an import cycle, let me offer a variant on goldfire's and
 adamgundry's proposals: When we type check a module that has an hs-boot
 file (here `B.hs`), do so in the type family instance environment of `B
 .hs-boot`. In other words, allow type family instances in hs-boot files
 and require of the user that if they want to use a type family instance
 while compiling `B.hs`, it must already be present in `B.hs-boot`.

 This is more lenient than "''every'' type family in `B.hs` ''must'' be
 listed in `B.hs-boot`" and I think it's a clearer or at least more
 implementable version of adamgundry's "must list all type instance
 declarations used (transitively) in the typechecking of [...]". Maybe it's
 even exactly equivalent to that.

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


More information about the ghc-tickets mailing list