Skip to content

TYPE 'UnboxedTupleRep is a lie

From @RyanGlScott, ticket:11471#comment:117929:

I notice that there's a single constructor of RuntimeRep for unboxed tuples (UnboxedTupleRep). Does this mean something like this should be allowed?

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
module Example where

import Data.Typeable
import GHC.Exts

data Wat (a :: TYPE 'UnboxedTupleRep) = Wat a

Currently, that fails to compile due to a separate GHC panic:

$ /opt/ghc/head/bin/ghc -O2 -fforce-recomp Example.hs
[1 of 1] Compiling Example          ( Example.hs, Example.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.1.20160317 for x86_64-unknown-linux):
        unboxed tuple PrimRep

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

But wouldn't this be dangerous anyway? After all, unboxed tuples are supposed to represent arguments on the stack, so couldn't unboxed tuple polymorphic potentially lead to the RTS miscalculating how much data to read? Or am I misreading this?

Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information