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

GHC ghc-devs at haskell.org
Mon Feb 8 16:15:57 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:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 For the record, the current plan (implemented in Phab:D1891) looks like
 this,
 {{{#!hs
 data RuntimeRep = PtrRep Levity   -- ^ represented by a pointer
 ​                | VecRep VecCount VecElem   -- ^ a SIMD vector type
 ​                | VoidRep         -- ^ erased entirely
 ​                | IntRep          -- ^ signed, word-sized value
 ​                | WordRep         -- ^ unsigned, word-sized value
 ​                | Int64Rep        -- ^ signed, 64-bit value (on 32-bit
 only)
 ​                | Word64Rep       -- ^ unsigned, 64-bit value (on 32-bit
 only)
 ​                | AddrRep         -- ^ A pointer, but /not/ to a Haskell
 value
 ​                | FloatRep        -- ^ a 32-bit floating point number
 ​                | DoubleRep       -- ^ a 64-bit floating point number
 ​                | UnboxedTupleRep -- ^ An unboxed tuple; this doesn't
 specify a concrete rep

 data VecCount = Vec2 | Vec4 | Vec8 | Vec16 | Vec32 | Vec64

 data VecElem = Int8ElemRep  | Int16ElemRep  | Int32ElemRep  | Int64ElemRep
              | Word8ElemRep | Word16ElemRep | Word32ElemRep |
 Word64ElemRep
              | FloatElemRep | DoubleElemRep

 data Levity = Lifted
             | Unlifted

 data TYPE (rep :: RuntimeRep) :: TYPE 'Lifted
 }}}

 Simon says,
 > I'm afraid I don't understand the idea of comment:9. I'm happy that
 Richard says he likes it, but what precisely is the suggestion?

 I think Reid was suggesting that `TYPE 'Lifted :: TYPE 'TypeRep` or
 something along those lines (where `TypeRep` would look very similar to
 `VoidRep`). This reflects the fact types (e.g. `Int`) have no runtime
 representation.

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


More information about the ghc-tickets mailing list