[GHC] #10828: TH could do a better job of representing GADTs

GHC ghc-devs at haskell.org
Tue Nov 10 08:53:12 UTC 2015


#10828: TH could do a better job of representing GADTs
-------------------------------------+-------------------------------------
        Reporter:  spinda            |                Owner:  jstolarek
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Template Haskell  |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by jstolarek):

 * owner:   => jstolarek


Comment:

 I can work on implementing that, but I have one question:

 > I think, in light of comment:5, we should add proper GADT support in TH.
 Why "in light of comment:5"? I read through #10447 and I saw this example
 by Simon:

 {{{#!hs
   data T1 a where
     MkT1 :: (a~Int) => a -> T1 a

   data T2 a where
     MkT2 :: Int -> T2 Int

   data T3 a where
     MkT3 :: (a~Int) => a -> T3 Int
 }}}
 All these declarations can be represented in TH:
 {{{#!hs
 data T1 a = a ~ Int => MkT1 a
 data T2 a = a ~ Int => MkT2 Int
 data T3 a = forall b. (a ~ Int, b ~ Int) => MkT3 b
 }}}
 It is possible to automatically derive `Foldable` for all three
 declarations `T1`, `T2` and `T3`, both in GADT form as well as in the
 standard form given above, so `DerivingFoldable` makes no distinction
 between these three declarations. Are there other declarations where
 `Foldable` distinguishes the two forms?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10828#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list