
#10828: TH can't represent all GADTs in its AST -------------------------------------+------------------------------------- Reporter: spinda | Owner: Type: feature request | Status: new Priority: normal | Milestone: 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 Revisions: -------------------------------------+------------------------------------- Comment (by goldfire): I believe the TH AST is fully expressive here (with one tiny caveat). It's just clunky. Take {{{ data T :: k -> * -> * where MkT :: T x Int }}} To encode into TH, you transform the definition to this: {{{ data T (a1 :: k) (a2 :: *) = forall . a2 ~ Int => MkT }}} which has a direct translation. The one tiny caveat is the new feature for deriving `Foldable` for GADTs, which distinguishes among the two forms above. (I can't find a reference to this change. Can you? It was described at Haskell Implementors' Workshop a few days ago. You, the reader, if you know the reference, please add it!) Is it worth refactoring the TH types to handle GADTs more directly? Perhaps. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10828#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler