[GHC] #13092: family instance consistency checks are too pessimistic

GHC ghc-devs at haskell.org
Tue Jan 10 00:41:58 UTC 2017


#13092: family instance consistency checks are too pessimistic
-------------------------------------+-------------------------------------
        Reporter:  rwbarton          |                Owner:  rwbarton
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 Actually this is wrong! I managed to write `unsafeCoerce` in my compiler
 with this change.

 The reason is that type family instances defined in a module `A` are not
 actually checked for consistency with all its family instance dependencies
 `B`, `C`, ...; that seems to only happen when the interface file for (say)
 `B` is read for some other reason. I'm not sure yet whether that means
 even the existing consistency checks are inadequate; but it's at least
 surprising that you can write a module that has a type family instance
 that conflicts with an indirect dependency.

 Just to say it again explicitly, because it seems strange: when compiling
 a module containing a type family instance, GHC does not read all its
 indirect dependencies which have type family instances to ensure
 consistency.

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


More information about the ghc-tickets mailing list