[GHC] #12723: Family instance modules are not fingerprinted in ABI

#12723: Family instance modules are not fingerprinted in ABI -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Driver | Version: 8.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: -------------------------------------+------------------------------------- This leads to the following delightful, five module bug: {{{ -- A.hs {-# LANGUAGE TypeFamilies #-} module A where type family F a type instance F Int = Bool -- B.hs module B where import A -- C.hs module C where import B -- D.hs module D where import C -- E.hs module E where import D import B }}} Build these modules. Then rename A to A2 (fixing B's import), and build them again. You'll get: {{{ ezyang@sabre:~/Dev/labs/T3871$ ghc --make E.hs [1 of 5] Compiling A2 ( A2.hs, A2.o ) [2 of 5] Compiling B ( B.hs, B.o ) [3 of 5] Compiling C ( C.hs, C.o ) [B changed] [5 of 5] Compiling E ( E.hs, E.o ) [B changed] attempting to use module ‘A’ (./A.hs) which is not loaded }}} The problem is clear: D was not recompiled, but it needs to be, because when the module gets renamed, we need to update its list of family instance modules to rename A to A2. When we don't do this, the subsequent family instance check chokes because it tries to load A. And why did D decide not to get recompiled? Because the ABI hash of B did not change. And that's WRONG. (Also, family instances are really awful, you really do have to rebuild everything when you change them. UGH.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12723 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12723: Family instance modules are not fingerprinted in ABI -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Driver | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by ezyang: @@ -44,1 +44,1 @@ - decide not to get recompiled? Because the ABI hash of B did not change. + decide not to get recompiled? Because the ABI hash of C did not change. New description: This leads to the following delightful, five module bug: {{{ -- A.hs {-# LANGUAGE TypeFamilies #-} module A where type family F a type instance F Int = Bool -- B.hs module B where import A -- C.hs module C where import B -- D.hs module D where import C -- E.hs module E where import D import B }}} Build these modules. Then rename A to A2 (fixing B's import), and build them again. You'll get: {{{ ezyang@sabre:~/Dev/labs/T3871$ ghc --make E.hs [1 of 5] Compiling A2 ( A2.hs, A2.o ) [2 of 5] Compiling B ( B.hs, B.o ) [3 of 5] Compiling C ( C.hs, C.o ) [B changed] [5 of 5] Compiling E ( E.hs, E.o ) [B changed] attempting to use module ‘A’ (./A.hs) which is not loaded }}} The problem is clear: D was not recompiled, but it needs to be, because when the module gets renamed, we need to update its list of family instance modules to rename A to A2. When we don't do this, the subsequent family instance check chokes because it tries to load A. And why did D decide not to get recompiled? Because the ABI hash of C did not change. And that's WRONG. (Also, family instances are really awful, you really do have to rebuild everything when you change them. UGH.) -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12723#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12723: Family instance modules are not fingerprinted in ABI -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Driver | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by ezyang: @@ -49,0 +49,3 @@ + + This occasionally affected the Cabal project, see + https://github.com/haskell/cabal/issues/3871 New description: This leads to the following delightful, five module bug: {{{ -- A.hs {-# LANGUAGE TypeFamilies #-} module A where type family F a type instance F Int = Bool -- B.hs module B where import A -- C.hs module C where import B -- D.hs module D where import C -- E.hs module E where import D import B }}} Build these modules. Then rename A to A2 (fixing B's import), and build them again. You'll get: {{{ ezyang@sabre:~/Dev/labs/T3871$ ghc --make E.hs [1 of 5] Compiling A2 ( A2.hs, A2.o ) [2 of 5] Compiling B ( B.hs, B.o ) [3 of 5] Compiling C ( C.hs, C.o ) [B changed] [5 of 5] Compiling E ( E.hs, E.o ) [B changed] attempting to use module ‘A’ (./A.hs) which is not loaded }}} The problem is clear: D was not recompiled, but it needs to be, because when the module gets renamed, we need to update its list of family instance modules to rename A to A2. When we don't do this, the subsequent family instance check chokes because it tries to load A. And why did D decide not to get recompiled? Because the ABI hash of C did not change. And that's WRONG. (Also, family instances are really awful, you really do have to rebuild everything when you change them. UGH.) This occasionally affected the Cabal project, see https://github.com/haskell/cabal/issues/3871 -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12723#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12723: Family instance modules are not fingerprinted in ABI -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Driver | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by ezyang: @@ -11,1 +11,1 @@ - module B where + module B (module A) where New description: This leads to the following delightful, five module bug: {{{ -- A.hs {-# LANGUAGE TypeFamilies #-} module A where type family F a type instance F Int = Bool -- B.hs module B (module A) where import A -- C.hs module C where import B -- D.hs module D where import C -- E.hs module E where import D import B }}} Build these modules. Then rename A to A2 (fixing B's import), and build them again. You'll get: {{{ ezyang@sabre:~/Dev/labs/T3871$ ghc --make E.hs [1 of 5] Compiling A2 ( A2.hs, A2.o ) [2 of 5] Compiling B ( B.hs, B.o ) [3 of 5] Compiling C ( C.hs, C.o ) [B changed] [5 of 5] Compiling E ( E.hs, E.o ) [B changed] attempting to use module ‘A’ (./A.hs) which is not loaded }}} The problem is clear: D was not recompiled, but it needs to be, because when the module gets renamed, we need to update its list of family instance modules to rename A to A2. When we don't do this, the subsequent family instance check chokes because it tries to load A. And why did D decide not to get recompiled? Because the ABI hash of C did not change. And that's WRONG. (Also, family instances are really awful, you really do have to rebuild everything when you change them. UGH.) This occasionally affected the Cabal project, see https://github.com/haskell/cabal/issues/3871 -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12723#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12723: Family instance modules are not fingerprinted in ABI -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Driver | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2607 Wiki Page: | -------------------------------------+------------------------------------- Changes (by ezyang): * status: new => patch * differential: => Phab:D2607 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12723#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12723: Family instance modules are not fingerprinted in ABI
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Driver | Version: 8.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2607
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Edward Z. Yang
participants (1)
-
GHC