Skip to content

Template Haskell drops singleton unboxed tuples

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.

Trac metadata
Trac field Value
Version 7.1
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