Skip to content

GHCi displays the kinds of unboxed tuples incorrectly

This can be reproduced in GHCi 8.0.2 or HEAD. First, a preamble:

$ inplace/bin/ghc-stage2 --interactive
GHCi, version 8.1.20161208: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
λ> :set -fprint-explicit-runtime-reps -fprint-explicit-kinds -fprint-explicit-foralls -XUnboxedTuples -XTemplateHaskell -XMagicHash 
λ> :m + GHC.Exts Language.Haskell.TH Language.Haskell.TH.Lib Language.Haskell.TH.Syntax

The kind of (#,#) is reported correctly:

(#,#) :: forall (k0 :: RuntimeRep) (k1 :: RuntimeRep).
         TYPE k0 -> TYPE k1 -> TYPE 'UnboxedTupleRep

But when you give it an argument, it seems to default TYPE k1 to * for some reason!

λ> :k (#,#) Int#
(#,#) Int# :: * -> TYPE 'UnboxedTupleRep

This is a blatant lie, as this kind-checks:

λ> :k (#,#) Int# Int#
(#,#) Int# Int# :: TYPE 'UnboxedTupleRep

The effect is even more noticeable when you throw TemplateHaskell into the mix:

λ> :k $(unboxedTupleT 2)
$(unboxedTupleT 2) :: * -> * -> TYPE 'UnboxedTupleRep
λ> :k $(unboxedTupleT 2) Int#
$(unboxedTupleT 2) Int# :: * -> TYPE 'UnboxedTupleRep
λ> :k $(conT (unboxedTupleTypeName 2))
$(conT (unboxedTupleTypeName 2)) :: * -> * -> TYPE 'UnboxedTupleRep
λ> :k $(conT (unboxedTupleTypeName 2)) Int#
$(conT (unboxedTupleTypeName 2)) Int# :: * -> TYPE 'UnboxedTupleRep

All of these kinds should be reporting the RuntimeReps that GHC is //actually// using under the hood.

Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
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