[GHC] #9692: Template Haskell reification for Data Families is buggy?

#9692: Template Haskell reification for Data Families is buggy? -------------------------------------+------------------------------------- Reporter: hpacheco | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Keywords: TemplateHaskell | Operating System: MacOS X Architecture: Unknown/Multiple | Type of failure: Difficulty: Unknown | None/Unknown Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- I have found an example where I think that the TH reification for data/newtype families is incorrect, in that if forgets non-instantiated type variables in instance declarations. For the attached example, it will infer the Info: {{{#!hs FamilyI (FamilyD DataFam TyFamReifyDefs.F [PlainTV a_1627399879,PlainTV b_1627399880] (Just StarT)) [DataInstD [] TyFamReifyDefs.F [ConT GHC.Types.Int] [NormalC TyFamReifyDefs.FInt [(NotStrict,VarT x_1627399881)]] []] }}} Note how the variable x is not declared in the body of the DataInstD. Since it does not need to have the same name as the family-declared variable, substituing is non-trivial this way... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9692 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9692: Template Haskell reification for Data Families is buggy? -------------------------------------+------------------------------------- Reporter: hpacheco | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: TemplateHaskell Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: | Difficulty: Unknown None/Unknown | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Description changed by hpacheco: Old description:
I have found an example where I think that the TH reification for data/newtype families is incorrect, in that if forgets non-instantiated type variables in instance declarations.
For the attached example, it will infer the Info:
{{{#!hs FamilyI (FamilyD DataFam TyFamReifyDefs.F [PlainTV a_1627399879,PlainTV b_1627399880] (Just StarT)) [DataInstD [] TyFamReifyDefs.F [ConT GHC.Types.Int] [NormalC TyFamReifyDefs.FInt [(NotStrict,VarT x_1627399881)]] []] }}}
Note how the variable x is not declared in the body of the DataInstD. Since it does not need to have the same name as the family-declared variable, substituing is non-trivial this way...
New description: I have found an example where I think that the TH reification for data/newtype families is incorrect, in that if forgets non-bound type variables in instance declarations. For the attached example, it will infer the Info: {{{#!hs FamilyI (FamilyD DataFam TyFamReifyDefs.F [PlainTV a_1627399879,PlainTV b_1627399880] (Just StarT)) [DataInstD [] TyFamReifyDefs.F [ConT GHC.Types.Int] [NormalC TyFamReifyDefs.FInt [(NotStrict,VarT x_1627399881)]] []] }}} Note how the variable x is not declared in the body of the DataInstD. Since it does not need to have the same name as the family-declared variable, substituting is non-trivial this way... -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9692#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9692: Template Haskell reification for Data Families is buggy? -------------------------------------+------------------------------------- Reporter: hpacheco | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 7.8.3 Haskell | Keywords: TemplateHaskell Resolution: | Architecture: Unknown/Multiple Operating System: MacOS X | Difficulty: Easy (less than 1 Type of failure: | hour) None/Unknown | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by hpacheco): * difficulty: Unknown => Easy (less than 1 hour) * component: Compiler => Template Haskell -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9692#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9692: Template Haskell reification for Data Families is buggy? -------------------------------------+------------------------------------- Reporter: hpacheco | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 7.8.3 Haskell | Keywords: TemplateHaskell Resolution: | Architecture: Unknown/Multiple Operating System: MacOS X | Difficulty: Easy (less than 1 Type of failure: | hour) None/Unknown | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by goldfire): * owner: => goldfire Comment: This gets a bit worse: reifying data families also includes kind parameters. Should be easy enough to fix, though... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9692#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9692: Template Haskell reification for Data Families is buggy? -------------------------------------+------------------------------------- Reporter: hpacheco | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 7.8.3 Haskell | Keywords: TemplateHaskell Resolution: | Architecture: Unknown/Multiple Operating System: MacOS X | Difficulty: Easy (less than 1 Type of failure: | hour) None/Unknown | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: Phab:D355 | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * differential: => Phab:D355 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9692#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9692: Template Haskell reification for Data Families is buggy?
-------------------------------------+-------------------------------------
Reporter: hpacheco | Owner: goldfire
Type: bug | Status: new
Priority: normal | Milestone:
Component: Template | Version: 7.8.3
Haskell | Keywords: TemplateHaskell
Resolution: | Architecture: Unknown/Multiple
Operating System: MacOS X | Difficulty: Easy (less than 1
Type of failure: | hour)
None/Unknown | Blocked By:
Test Case: | Related Tickets:
Blocking: |
Differential Revisions: Phab:D355 |
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#9692: Template Haskell reification for Data Families is buggy?
-------------------------------------+-------------------------------------
Reporter: hpacheco | Owner: goldfire
Type: bug | Status: new
Priority: normal | Milestone:
Component: Template | Version: 7.8.3
Haskell | Keywords: TemplateHaskell
Resolution: | Architecture: Unknown/Multiple
Operating System: MacOS X | Difficulty: Easy (less than 1
Type of failure: | hour)
None/Unknown | Blocked By:
Test Case: | Related Tickets:
Blocking: |
Differential Revisions: Phab:D355 |
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#9692: Template Haskell reification for Data Families is buggy? -------------------------------------+------------------------------------- Reporter: hpacheco | Owner: goldfire Type: bug | Status: closed Priority: normal | Milestone: Component: Template | Version: 7.8.3 Haskell | Keywords: TemplateHaskell Resolution: fixed | Architecture: Unknown/Multiple Operating System: MacOS X | Difficulty: Easy (less than 1 Type of failure: | hour) None/Unknown | Blocked By: Test Case: th/T9692 | Related Tickets: Blocking: | Differential Revisions: Phab:D355 | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * testcase: => th/T9692 * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9692#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9692: Template Haskell reification for Data Families is buggy?
-------------------------------------+-------------------------------------
Reporter: hpacheco | Owner: goldfire
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Template Haskell | Version: 7.8.3
Resolution: fixed | Keywords:
| TemplateHaskell
Operating System: MacOS X | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case: th/T9692
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D355
-------------------------------------+-------------------------------------
Comment (by Ryan Scott
participants (1)
-
GHC