[GHC] #11357: Regression when deriving Generic1 on poly-kinded data family
GHC
ghc-devs at haskell.org
Mon Jan 11 01:40:35 UTC 2016
#11357: Regression when deriving Generic1 on poly-kinded data family
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 8.0.1
Component: Compiler | Version: 7.11
(CodeGen) | Keywords: Generics,
Resolution: | TypeInType
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
Something fishy is going on with the kind of the `ProxyFam` instance
`TyCon`. I added `pprTrace`-ed the result of `tyConKind tc` right before
the call to `filterOutInvisibleTypes` mentioned above, and noticed a
discrepancy between datatypes and data families:
{{{
$ inplace/bin/ghc-stage2 --interactive
GHCi, version 8.1.20160109: http://www.haskell.org/ghc/ :? for help
λ> :set -XDeriveGeneric -XTypeFamilies -XPolyKinds -fprint-explicit-
foralls
λ> import GHC.Generics
λ> data Proxy (a :: k) = Proxy deriving Generic1
tc: Proxy
tyConKind tc: forall k_a1Gj. k_a1Gj -> *
tc_args: [*]
filterOutInvisibleTypes tc tc_args: []
all isTyVarTy: True
λ> data family ProxyFam (a :: k)
λ> data instance ProxyFam (a :: k) = ProxyCon deriving Generic1
tc: R:ProxyFamka
tyConKind tc: forall k_a1Ps -> k_a1Ps -> *
tc_args: [*]
filterOutInvisibleTypes tc tc_args: [*]
all isTyVarTy: False
<interactive>:5:53: error:
• Can't make a derived instance of ‘Generic1 ProxyFam’:
ProxyFam must not be instantiated; try deriving `ProxyFam k a'
instead
• In the data instance declaration for ‘ProxyFam’
}}}
Notice that `tyConKind` for the datatype `Proxy` is `forall k. k -> *`
(i.e., `k` is specified but not visible), but the `tyConKind` for the
`ProxyFam` instance is `forall k -> k -> *` (`k` is visible)! This is
definitely the reason why this bug is manifesting itself, although I'm not
sure why `k` is a visible type argument in the `ProxyFam` instance.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11357#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list