Opened 13 months ago

Last modified 5 months ago

#15843 new bug

Tuple sections can't be quoted

Reported by: mpickering Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.6.1
Keywords: newcomer, TemplateHaskell Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by osa1)

There are quite a few forms that are not supported in template haskell quotes. It seems that it would be at least a good warm up patch to add support for tuple sections which you can do simply by desugaring to a lambda and the normal tuple constructor.

{-# LANGUAGE TemplateHaskell #-}                                                
{-# LANGUAGE TupleSections #-}                                                  
module Foo where                                                                
foo = [|| (,5) ||]
  1. Modify DsMeta.repE to handle tuple sections. You can desugar (,5) => \x -> (x, 5).
  2. Add the above test to the test suite.

Change History (4)

comment:1 Changed 13 months ago by bgamari

Keywords: TemplateHaskell added

comment:2 Changed 13 months ago by goldfire

I disagree with the design in the original post. TH syntax should really be as close as possible to Haskell syntax. Instead, I would say that TH should support tuple sections directly. I propose changing TupE :: [Exp] -> Exp to become TupE :: [Maybe Exp] -> Exp.

comment:3 Changed 12 months ago by osa1

Description: modified (diff)

comment:4 Changed 5 months ago by Marge Bot <ben+marge-bot@…>

In cef80c0b/ghc:

Fix #15843 by extending Template Haskell AST for tuples to support sections
Note: See TracTickets for help on using tickets.