[GHC] #12115: CoreLint error in safe program

GHC ghc-devs at haskell.org
Sun May 29 18:00:09 UTC 2016


#12115: CoreLint error in safe program
-------------------------------------+-------------------------------------
        Reporter:  osa1              |                Owner:
            Type:  bug               |               Status:  merge
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
                                     |  codegen/should_compile/T12115
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 I'm a bit lost with these patches.

 - The commentary says that `(# #)` becomes `Void#` during unarisation. But
 there is also a change in !TysWiredIn that removes the special case for
 nullary unboxed tuples.

 - `Note [The kind invariant]` is awfully out-of-date:

 {{{
 Note [The kind invariant]
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 The kinds
    #          UnliftedTypeKind
    OpenKind   super-kind of *, #

 can never appear under an arrow or type constructor in a kind; they
 can only be at the top level of a kind.  It follows that primitive TyCons,
 which have a naughty pseudo-kind
    State# :: * -> #
 must always be saturated, so that we can never get a type whose kind
 has a UnliftedTypeKind or ArgTypeKind underneath an arrow.

 Nor can we abstract over a type variable with any of these kinds.

     k :: = kk | # | ArgKind | (#) | OpenKind
     kk :: = * | kk -> kk | T kk1 ... kkn

 So a type variable can only be abstracted kk.
 }}}

    (I'm sure I'm implicated in letting this fall out-of-date. But I
 honestly don't know how to fix.)

    There is no `#` anymore, and there is no `OpenKind` anymore. One might
 think this means that a representation-polymorphic kind (that is, `TYPE
 r`) cannot appear below top-level, but indeed they do, as in the type of
 `error`. So I'm not sure what this is saying.

    Also, this Note is missing ''why'' these restrictions are in place. I
 recall several months ago moving to allow unsaturated unlifted things, but
 now we've backpedaled on this decision. I'm sure there's a good reason,
 but what is it? This Note is also missing ''where'' these restrictions are
 enforced. Is there a check in !CoreLint that we never abstract over a kind
 `* -> TYPE <something unlifted>`?

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


More information about the ghc-tickets mailing list