Opened 6 years ago

Closed 6 years ago

#5332 closed bug (fixed)

Template Haskell drops singleton unboxed tuples

Reported by: reinerp Owned by:
Priority: normal Milestone:
Component: Template Haskell Version: 7.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC accepts invalid program Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The following module compiles with Ghc HEAD, but shouldn't:

{-# LANGUAGE TemplateHaskell, UnboxedTuples #-}
module Tuple where

import Language.Haskell.TH

f :: Int
f = $( [| (# 0 #) |] )

In hsSyn/Convert.lhs, we can see why this is happening; we have a handful of lines like this:

    cvt (UnboxedTupE [e])     = cvt e	-- Singleton tuples treated like nothing (just parens)

This is correct for boxed tuples, but not for unboxed tuples.

Change History (6)

comment:1 Changed 6 years ago by igloo@…

commit 14d5e04a87717eab39007c4b329553b55f53ad35

Author: Ian Lynagh <>
Date:   Tue Jul 19 20:59:05 2011 +0100

    Fix #5332: (# 0 #), unlike ( 0 ), is not the same as 0

 compiler/hsSyn/Convert.lhs |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

comment:2 Changed 6 years ago by igloo

Status: newmerge

Thanks for the report; fixed.

comment:3 Changed 6 years ago by reinerp

Status: mergenew

Sorry, I should have mentioned that there's some other instances of this, in Convert.cvtType and Convert.cvtp.

comment:4 Changed 6 years ago by simonpj@…

commit 9f095a456eefbf9752ca773ecba148b471586cf0

Author: Simon Peyton Jones <>
Date:   Wed Jul 20 10:15:52 2011 +0100

    Fix #5332 (more): unboxed singleton tuples are fine
    This patch fixes the unboxed singleton tuples in types and patterns

 compiler/hsSyn/Convert.lhs |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

comment:5 Changed 6 years ago by simonpj

Status: newmerge

Ah yes. Fixed; pls merge.

comment:6 Changed 6 years ago by igloo

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.