Allow type families in RuntimeReps
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 (closed) 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.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |