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

GHC ghc-devs at haskell.org
Wed Oct 15 03:55:05 UTC 2014


#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


More information about the ghc-tickets mailing list