[GHC] #15852: Bad axiom produced for polykinded data family
GHC
ghc-devs at haskell.org
Mon Nov 12 07:47:39 UTC 2018
#15852: Bad axiom produced for polykinded data family
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.7
Resolution: | Keywords: TypeFamilies,
| TypeInType
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 RyanGlScott):
Oh dear. Yes, I //was// barking up the wrong tree—thank you for setting me
straight.
Now that I dig closer into `ppr_co_axiom_branch` (which is the real
culprit), I now understand what went wrong. When implementing
`etaExpandFamInstLHS`, I left
[http://git.haskell.org/ghc.git/blob/d30352add1da67dd0346613853cd423c7becbaeb:/compiler/types/Type.hs#l3067
this comment]:
{{{#!hs
-- @Note [Eta reduction for data families]@ in "FamInstEnv". Because the
-- right-hand side is where the eta-reduced variables are obtained from,
it
-- is not returned from this function (as there is never a need to modify
it).
}}}
In retrospect, I have no idea what I was smoking when I wrote this
comment, because it's completely wrong. The right-hand side //is// eta-
reduced, and that's what we're seeing in `-ddump-tc`. (Moreover, we aren't
obtaining the eta-reduced variables from the RHS at all. They're actually
being taken from the `tyConTyVars` of the representation `TyCon`.)
This suggests a straightforward fix: just eta expand the RHS as well, and
return that from `etaExpandFamInstLHS` (or really, it just should be
called `etaExpandFamInst`). I'll give that a shot.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15852#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list