#4188: Template Haskell support for reifying non-vanilla data constructors
-------------------------------+--------------------------------------------
  Reporter:  illissius         |          Owner:  illissius       
      Type:  feature request   |         Status:  closed          
  Priority:  normal            |      Milestone:                  
 Component:  Template Haskell  |        Version:                  
Resolution:  fixed             |       Keywords:                  
Difficulty:                    |             Os:  Unknown/Multiple
  Testcase:  th/T4188          |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown      |  
-------------------------------+--------------------------------------------
Changes (by simonpj):

  * status:  patch => closed
  * testcase:  => th/T4188
  * resolution:  => fixed


Comment:

 Very true! Done.  As a result I've fixed it so you can reify *anything*
 {{{
 Wed Jul 21 02:04:37 PDT 2010  [email protected]
   * Allow reification of existentials and GADTs

   It turns out that TH.Syntax is rich enough to express even GADTs,
   provided we express them in equality-predicate form.  So for
   example

     data T a where
        MkT1 :: a -> T [a]
        MkT2 :: T Int

   will appear in TH syntax like this

     data T a = forall b. (a ~ [b]) => MkT1 b
              | (a ~ Int) => MkT2

   While I was at it I also improved the reification of types,
   so that we use TH.TupleT and TH.ListT when we can.

     M ./compiler/typecheck/TcSplice.lhs -25 +58
 }}}
 There's a related library patch to tidy up pretty printing
 {{{
 Wed Jul 21 02:05:38 PDT 2010  [email protected]
   * Improve TH pretty printing

     M ./Language/Haskell/TH/Ppr.hs -21 +21
 }}}
 and you need this DPH patch
 {{{
 Wed Jul 21 08:03:55 PDT 2010  [email protected]
   * Take account of ListT and TupleT in TH.Syntax

     M ./dph-common/Data/Array/Parallel/Lifted/TH/Repr.hs -1 +4
 }}}
 I added a test to the regression suite too.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4188#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to