[GHC] #13105: Allow type families in RuntimeReps
GHC
ghc-devs at haskell.org
Wed Jan 11 01:42:22 UTC 2017
#13105: Allow type families in RuntimeReps
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Conal Elliott provided me with this puzzle:
{{{
type family RepRep a ∷ RuntimeRep
class HasRep a where
type Rep a ∷ TYPE (RepRep a)
repr ∷ a → Rep a
abst ∷ Rep a → a
type instance RepRep Int = IntRep
instance HasRep Int where
type Rep Int = Int#
abst n = I# n
repr (I# n) = n
}}}
I think we should accept. However, doing so (even with my solution to
#12809 complete) is hard, because we frequently consult a kind in order to
determine a runtime representation. When that kind is `TYPE (RepRep Int)`,
the code generator throws up its arms in despair.
The solution here is either to teach the code generator how to normalise
types (requiring propagating the `FamInstEnvs`) or to do a whole-program
transformation at some point (zonker? desugarer? maybe we can wait until
!CorePrep or even unarisation?) to change ids whose types have kinds like
`TYPE (RepRep Int)` into ids with types with kinds like `TYPE IntRep`.
But I don't want to let this hold me up at the moment, so I'm posting here
as a reminder to revisit this problem.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13105>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list