[GHC] #9858: Typeable instance for datatype and its promoted constructor is the same
GHC
ghc-devs at haskell.org
Mon Jan 19 23:58:38 UTC 2015
#9858: Typeable instance for datatype and its promoted constructor is the same
-------------------------------------+-------------------------------------
Reporter: dreixel | Owner: dreixel
Type: bug | Status: new
Priority: highest | Milestone: 7.10.1
Component: Compiler | Version: 7.9
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by goldfire):
I see two different issues at work here:
1. If we have `data A = A`, then (typeRep (Proxy :: Proxy A)) and (typeRep
(Proxy :: Proxy 'A)) are equal. This is not a problem with kinds, but a
problem with namespaces. To me, the salient difference between `A` and
`'A` is not that their kinds are different, but that they represent
totally different entities. Fixing this issue is simple, either by adding
some namespace information to `TyCon` or putting some marker in the
`tyConName` string.
2. If we have `data B x` (no constructors), then `B :: forall k. k -> *`.
The types `(B :: Bool -> *)` and `(B :: Ordering -> *)` are actually, in
Core, `B Bool` and `B Ordering` -- in Core, kind arguments are explicit.
Thus, the `TypeRep` for `B :: Bool -> *` could feasibly be `TypeRep
<fingerprint> <B's TyCon> [<Bool's TypeRep>]`. The change here isn't to
the structure of `TyCon`, but instead mandating that all kind arguments
are explicit in `TypeRep`s, just like they are in Core. Indeed, it
surprises me that this isn't already the case! I believe that making kind
arguments explicit in `TypeRep`s will be a simplification.
Personally, it seems adding kind information to `TypeRep` is not the best
approach here.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9858#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list