Opened 6 weeks ago

Last modified 3 days 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 (3)

comment:1 Changed 6 weeks ago by bgamari

Keywords: TemplateHaskell added

comment:2 Changed 4 weeks 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 3 days ago by osa1

Description: modified (diff)
Note: See TracTickets for help on using tickets.