[GHC] #10811: Template Haskell does associated types poorly (printing & quoting)

GHC ghc-devs at haskell.org
Sat Aug 29 04:12:48 UTC 2015


#10811: Template Haskell does associated types poorly (printing & quoting)
-------------------------------------+-------------------------------------
              Reporter:  goldfire    |             Owner:  goldfire
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:  7.12.1
             Component:  Template    |           Version:  7.10.2
  Haskell                            |
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 When I say

 {{{
 {-# LANGUAGE TemplateHaskell, TypeFamilies #-}
 {-# OPTIONS_GHC -ddump-splices -dsuppress-uniques #-}

 module Bug where

 $([d| class C a where
         type F a
         type F a = a |])
 }}}

 I get

 {{{
     [d| class C a where
           type family F a
           F a = a |]
   ======>

 Bug.hs:6:7: Warning:
     Cannot desugar this Template Haskell declaration:
         class C a where
           type family F a
           F a = a
 }}}

 There are two problems here:

 1. This really should work.

 2. The pretty-printer here omits the `type` on the default definition for
 `F`. (The word `family` is optional there, but isn't actually wrong.)

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


More information about the ghc-tickets mailing list