
#12985: GHCi incorrectly reports the kind of unboxed tuples spliced in from Template Haskell -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 8.0.2 Haskell | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: #12976 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- First noticed in #12976. First, fire up GHCi 8.0.2 (or HEAD) and enable some options: {{{ $ 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 }}} Next, try looking at the kind of a regular unboxed tuple: {{{ λ> :k (#,#) (#,#) :: forall (a :: RuntimeRep) (b :: RuntimeRep). TYPE a -> TYPE b -> TYPE 'UnboxedTupleRep }}} But when you splice in the unboxed tuple type constructor via Template Haskell, `:k` misbehaves: {{{ λ> :k $(unboxedTupleT 2) $(unboxedTupleT 2) :: * -> * -> TYPE 'UnboxedTupleRep }}} This kind is totally wrong, since you //can// in fact apply this type constructor to types with kinds other than `*`: {{{ λ> :k $(unboxedTupleT 2) Int# Int# $(unboxedTupleT 2) Int# Int# :: TYPE 'UnboxedTupleRep }}} Moreover, this appears to be a regression since GHC 8.0.1, since if you try this in GHCi 8.0.1: {{{ $ /opt/ghc/8.0.1/bin/ghci GHCi, version 8.0.1: 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 λ> :k $(unboxedTupleT 2) $(unboxedTupleT 2) :: forall (a :: RuntimeRep) (b :: RuntimeRep). TYPE a -> TYPE b -> TYPE 'UnboxedTupleRep }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12985 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler