[GHC] #11471: Kind polymorphism and unboxed types: bad things are happening

GHC ghc-devs at haskell.org
Thu Jan 21 23:53:33 UTC 2016


#11471: Kind polymorphism and unboxed types: bad things are happening
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  goldfire
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.10.3
  checker)                           |             Keywords:  TypeInType,
      Resolution:                    |  LevityPolymorphism
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * owner:   => goldfire


Comment:

 Richard and I developed a plan this afternoon.

 '''Principle''': the kind of a type tells you its runtime representation
 (both width and pointer-hood).

 Currently we have
 {{{
 data Levity = Lifted | Unlifted
 }}}
 With this new principle we would have
 {{{
 data Levity
   = L    -- Lifted, boxed, represented by a pointer
   | UB   -- Unlifted, boxed, represented by a pointer
   | UV   -- Unboxed, zero width
   | UW32 -- Unboxed, represented by a 32 bit word
   | UW64 -- Unboxed, represented by a 64 bit word
   | UF32 -- Unboxed, represented by a 32 bit float
   | UF64 -- Unboxed, represented by a 64 bit float
   ...etc...
 }}}
 Pretty much one case for each constructor in `PrimRep`.

 And that's it really.  Now `typePrimRep` just takes the kind, and converts
 it to a `PrimRep`.

 This is a nice generalisation, and (we think) solves the problem.

 We need a Levity wiki page!!

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


More information about the ghc-tickets mailing list