[GHC] #15627: Absent unlifted bindings

GHC ghc-devs at haskell.org
Thu Sep 13 07:55:55 UTC 2018


#15627: Absent unlifted bindings
-------------------------------------+-------------------------------------
        Reporter:  sgraf             |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  ⊥
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #9279 #4328       |  Differential Rev(s):
  #11126                             |
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 No -- don't put a `TyCon` in `RubbishLit`.  Instead:
 {{{
 data Literal = RubbishAddr   -- Replaces MachNullAddr
              | RubbishLit
              | ...as before...

 literalType RubbishAddr = Addr#
 literalType RubbishLit  = forall (a :: TYPE UnliftedRep). a
 }}}
 So now, the core term
 {{{
 (Literal RubbishLit) `App` (Type (TyConApp MutVar# [Int]))
 }}}
 We can't use `(RubbishLit @Addr#)` for `RubbishAddr` because `Addr# ::
 TYPE AddrRep`, which is ill-kinded.

 Actually, I suppose that some C APIs might want the null addr (zero, I
 think?) specifically, rather than "any old rubbish value", so maybe we
 want to retain `MachNullAddr` rather than replace it with `RubbishAddr`.

 Yet another variant would be to give `RubbishLit` the type `forall r
 (a::TYPE r). a`.   Operationally, we simply don't initialise `RubbishLit`
 values; whereas using `0` for `Int#` and `'x'` for `Char#` still forces us
 to initialise.

 I'd be inclined to stick with the non-levity-polymorphic version
 initially.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15627#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list