#5217: GADT declaration not (yet) handled by Template Haskell
----------------------------------------+-----------------------------------
  Reporter:  Ashley Yakeley             |          Owner:                  
      Type:  bug                        |         Status:  closed          
  Priority:  normal                     |      Milestone:                  
 Component:  Compiler (Type checker)    |        Version:  7.0.3           
Resolution:  fixed                      |       Keywords:                  
  Testcase:  th/T5217                   |      Blockedby:                  
Difficulty:                             |             Os:  Unknown/Multiple
  Blocking:                             |   Architecture:  Unknown/Multiple
   Failure:  GHC rejects valid program  |  
----------------------------------------+-----------------------------------
Changes (by simonpj):

  * status:  new => closed
  * testcase:  => th/T5217
  * resolution:  => fixed


Comment:

 I've fixed this.  I did not need to extend TH syntax, because it's already
 rich enough to do the job (cf #4188).
 {{{
 commit 5c4a4c4bfe2a007f41f42ebab689bcd7219bed0d
 Author: Simon Peyton Jones <[email protected]>
 Date:   Sat Jun 11 16:44:07 2011 +0100

     Make TH capable of quoting GADT declarations (Trac #5217)

     Template Haskell doesn't support GADTs directly but
     we can use equality constraints to do the job. Here's
     an example of the dump from splicing such a declaration:

         [d| data T a b
                 where
                   T1 :: Int -> T Int Char
                   T2 :: a -> T a a
                   T3 :: a -> T [a] a
                   T4 :: a -> b -> T b [a] |]
       ======>
         T5217.hs:(6,3)-(9,53)
         data T a[aQW] b[aQX]
             = (b[aQX] ~ Char, a[aQW] ~ Int) => T1 Int |
               b[aQX] ~ a[aQW] => T2 a[aQW] |
               a[aQW] ~ [b[aQX]] => T3 b[aQX] |
               forall a[aQY]. b[aQX] ~ [a[aQY]] => T4 a[aQY] a[aQW]

  compiler/deSugar/DsMeta.hs      |  110
 +++++++++++++++++++++++++++++----------
  compiler/hsSyn/HsTypes.lhs      |   14 +++++
  compiler/typecheck/TcHsType.lhs |   19 +------
  compiler/typecheck/TcMType.lhs  |    5 +-
  4 files changed, 102 insertions(+), 46 deletions(-)
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5217#comment:1>
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