[GHC] #13747: Can't use 'instance' keyword in associated type family instance

GHC ghc-devs at haskell.org
Tue May 23 14:20:45 UTC 2017


#13747: Can't use 'instance' keyword in associated type family instance
-------------------------------------+-------------------------------------
           Reporter:  nh2            |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  error/warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html
 #associated-instances The manual on type families says:]

 > When an associated data or type synonym family instance is declared
 within a type class instance, we (optionally) may drop the instance
 keyword in the family instance"

 But that doesn't work for me.

 Using

 {{{
 class Myclass a where
   type family MyFamily a :: *
 }}}

 then the code

 {{{
 instance Myclass Mytype where
   type instance MyFamily Mytype = Int
 }}}

 doesn't compile but

 {{{
 instance Myclass Mytype where
   type          MyFamily Mytype = Int
 }}}

 I'd expect to be able to use the `instance` keyword here.

 I'd prefer this to be treated as an implementation bug instead of a doc
 bug, because I think it can be useful to be explicit for the ease of
 reading (and it work works the same way for class declaration, as the
 example also demonstrates).

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


More information about the ghc-tickets mailing list