
#11120: Missing type representations -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: patch Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1769 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): We appear to be on to Phab:D1774 now, correct? Change the Phab link? Like Richard I'm getting lost. That Phab seems to be spiraling out of control. Let's take one thing at at time. * Is `Proxy Char#` a valid type? Not currently: we get {{{ Illegal unlifted type: Char# }}} But there is no reason for this to be rejected! `Proxy :: forall k. k ->*`, and I see no reason why we can't instantiate `k` with `TYPE Unlifted`. Looking further, the error message comes not from the kind- unifier, but later in `TcValidity`; see `check_lifted`. I think we can probably simply remove all calls to `check_lifted`. * Can you have `TypeRep Char#` or `typeRep @Char#`, or `Typeable Char#`. Again, you can't right now, but actually I think you could; they are all kind-polymorphic, and the instantiating kind could be `TYPE Unlifted`. * If we did, we might be faced with solving `Typeable Char#`. That would mean adding a type rep for `Char#`; but we could simply make it insoluble for now, and report a type error. * Could solving `Typeable Char#` come up in GHC today (i.e. without fixing `TcValidity`)? Yes: consider `typeRep (undefined :: Proxy (Char# -> Int)`. Nothing wrong with that on the face of it. So we generate `Typeable (Char# -> Int)` constraint, and then decompose to `Typeable Char#` and `Typeable Int`. And then we fail in solving `Typeable Char#` * What about ''promoted'' data constructors? {{{ data CH = DCH Char# }}} Now suppose (comment:14) that we ask for `typeOf (Proxy :: Proxy 'DCH)`. This gives `Typeable 'DCH`. At the moment I can't see why that would need a type-rep for `Char#` as comment:14 suggests. Any ideas? So my proposal is: * Let's NOT (yet) have type-reps for primitive types * Let's fix the Typeable solver so that it fails gracefully on `Typeable Char#`. * And let's try the effect of removing the `check_unlifted` in `TcValidity`. Would that be a good start? That still leaves open the questions in comment:3. But first things first. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11120#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler