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 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.
<details><summary>Trac metadata</summary>
| 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 | |
</details>
<!-- {"blocked_by":[],"summary":"Allow type families in RuntimeReps","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Conal Elliott provided me with this puzzle:\r\n\r\n{{{\r\ntype family RepRep a ∷ RuntimeRep\r\n\r\nclass HasRep a where\r\n type Rep a ∷ TYPE (RepRep a)\r\n repr ∷ a → Rep a\r\n abst ∷ Rep a → a\r\n\r\ntype instance RepRep Int = IntRep\r\n\r\ninstance HasRep Int where\r\n type Rep Int = Int#\r\n abst n = I# n\r\n repr (I# n) = n\r\n}}}\r\n\r\nI 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.\r\n\r\nThe 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`.\r\n\r\nBut 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.","type_of_failure":"OtherFailure","blocking":[]} -->
issue