Skip to content

Can't use 'instance' keyword in associated type family instance

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).

Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC nh2
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information