[GHC] #12777: reify yields the wrong type in the presence of functional rependencies

#12777: reify yields the wrong type in the presence of functional rependencies -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.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: -------------------------------------+------------------------------------- {{{reify}}} yields an incomplete type in the following program. {{{ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE FunctionalDependencies #-} module B where import Language.Haskell.TH as TH import Language.Haskell.TH.Syntax as TH class C a b | a -> b where yo :: a -> IO b instance C Bool Int where yo = undefined t3 :: IO () t3 = do x <- yo True $(do addModFinalizer $ TH.reify 'x >>= runIO . print [| return () |] ) }}} {{{ $ inplace/bin/ghc-stage2 B.hs -fforce-recomp [1 of 1] Compiling B ( B.hs, B.o ) VarI x_1627401898 (VarT a_1627404604) Nothing }}} The problem seems to be that finalizers run before functional dependencies are considered. Hacking ghc to run finalizers after {{{simplifyTop}}} produces the expected output instead: {{{ $ inplace/bin/ghc-stage2 B.hs -fforce-recomp [1 of 1] Compiling B ( B.hs, B.o ) VarI x_1627404863 (ConT GHC.Types.Int) Nothing }}} Would anyone object to running finalizers after {{{simplifyTop}}}? This implies that finalizers shouldn't add definitions (with {{{addTopDecls}}}) which depend on {{{simplifyTop}}} to be type-checked. Another option is to call {{{simplifyTop}}} before and after running finalizers. But is it safe to do so? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12777 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12777: reify yields the wrong type in the presence of functional rependencies -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.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: | -------------------------------------+------------------------------------- Changes (by facundo.dominguez): * cc: bgamari (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12777#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12777: reify yields the wrong type in the presence of functional dependencies -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.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: | -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12777#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12777: reify yields the wrong type in the presence of functional dependencies -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: template- | haskell reify Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by facundo.dominguez): * keywords: => template-haskell reify -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12777#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12777: reify yields the wrong type in the presence of functional dependencies -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: template- | haskell reify Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * component: Compiler => Template Haskell -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12777#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12777: reify yields the wrong type in the presence of functional dependencies -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: template- | haskell reify Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Calling `simplifyTop` multiple times should be OK, as long as it's passed different constraints each time. Actually seems reasonable here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12777#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12777: reify yields the wrong type in the presence of functional dependencies -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: patch Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: template- | haskell reify Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2659 Wiki Page: | -------------------------------------+------------------------------------- Changes (by facundo.dominguez): * status: new => patch * differential: => Phab:D2659 * component: Template Haskell => Compiler -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12777#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12777: reify yields the wrong type in the presence of functional dependencies -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: patch Priority: normal | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: template- | haskell reify Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2659 Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * component: Compiler => Template Haskell Comment: The "Template Haskell" component applies to all bugs/fixes that are primarily about TH, even if the code changed is in GHC proper. Thanks. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12777#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12777: reify yields the wrong type in the presence of functional dependencies -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: patch Priority: high | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: template- | haskell reify Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2659 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * priority: normal => high Comment: Mathieu would like to see this for 8.0.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12777#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12777: reify yields the wrong type in the presence of functional dependencies
-------------------------------------+-------------------------------------
Reporter: | Owner:
facundo.dominguez |
Type: bug | Status: patch
Priority: high | Milestone: 8.0.2
Component: Template Haskell | Version: 8.0.1
Resolution: | Keywords: template-
| haskell reify
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2659
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#12777: reify yields the wrong type in the presence of functional dependencies -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: closed Priority: high | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: fixed | Keywords: template- | haskell reify Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2659 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: This was merged to `ghc-8.0` as e7c12cdaa7df8a7c71395da026c003ed36d3cbe6. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12777#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC