Skip to content

Can't splice a partially applied PromoteTupleT type from Template Haskell

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where

import Language.Haskell.TH.Syntax

type T1 = $(return (PromotedTupleT 2))
type T2 = $([t| '(,) |])
type T3 = $(return (PromotedT (tupleDataName 2)))

The splices for T2 and T3 both work. However, the splice for T1 causes Template Haskell to have a conniption:

$ /opt/ghc/8.2.2/bin/ghci Bug.hs
GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )

Bug.hs:7:13: error:
    • Malformed type PromotedTupleT 2
      When splicing a TH type: '(,)
    • In the untyped splice: $(return (PromotedTupleT 2))
  |
7 | type T1 = $(return (PromotedTupleT 2))
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^

Patch incoming.

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