Skip to content

Template Haskell drops unary tuples

Summary

Template Haskell drops unary tuples

Steps to reproduce

foo = $( return (TupE [VarE 'undefined]) )

bar = foo `seq` "hi"

and evaluate bar. You will observe undefined is evaluated leading to an exception.

Expected behavior

I expect Template Haskell to throw an exception, saying that unary tuples do not exist.

Environment

  • GHC version used: 8.6

Commentary

Convert.hs drops unary tuple constructors. Of course, we don't have unary boxed tuples, but if foo is accepted above, I would surely expect bar to be "hi". Instead, we should just reject foo outright.

Edited by Richard Eisenberg
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information