[GHC] #9450: GHC instantiates Data instances before checking hs-boot files

GHC ghc-devs at haskell.org
Thu May 11 18:27:31 UTC 2017


#9450: GHC instantiates Data instances before checking hs-boot files
-------------------------------------+-------------------------------------
        Reporter:  alanz             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.8.3
  checker)                           |             Keywords:  deriving, hs-
      Resolution:                    |  boot
Operating System:  Unknown/Multiple  |         Architecture:  x86_64
 Type of failure:  Compile-time      |  (amd64)
  crash                              |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #13591            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * related:   => #13591


Comment:

 Interestingly, if you compile this with GHC 8.0.1 or later, you get an
 error described in #13591:

 {{{
 $ /opt/ghc/8.0.1/bin/ghci HsLit.hs
 GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 4] Compiling HsLit[boot]      ( HsLit.hs-boot, interpreted )
 [2 of 4] Compiling HsExpr[boot]     ( HsExpr.hs-boot, interpreted )
 [3 of 4] Compiling HsExpr           ( HsExpr.hs, interpreted )

 HsExpr.hs:1:1: error:
     instance (Data.Data.Data id, Data.Data.Data (HsLit.TypeAnnot id),
               Data.Data.Data (HsLit.NameAnnot id)) =>
              Data.Data.Data (HsExpr id)
       -- Defined at HsExpr.hs-boot:19:10
       is defined in the hs-boot file, but not in the module itself

 HsExpr.hs-boot:17:1: error:
     Type constructor ‘HsExpr’ has conflicting definitions in the module
     and its hs-boot file
     Main module: data HsExpr i = E i | E2 i
     Boot file:   type role HsExpr nominal
                  abstract HsExpr i
     The roles do not match.
     Roles on abstract types default to ‘representational’ in boot files.
 *** Exception: expectJust showModule
 CallStack (from HasCallStack):
   error, called at compiler/utils/Maybes.hs:48:27 in ghc:Maybes
 }}}

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


More information about the ghc-tickets mailing list