Unexpected type application in default declaration
All of these work:
{-# LANGUAGE PolyKinds, TypeApplications, TypeFamilies, FlexibleInstances #-}
import Data.Kind (Type)
data B (a :: k)
type family FClosed :: k -> Type where
FClosed @k = B @k
type family FOpen :: k -> Type
type instance FOpen @k = B @k
class FAssocClass k where
type FAssoc :: k -> Type
instance FAssocClass k where
type FAssoc @k = B @k
This one doesn't:
class FAssocDefaultClass k where
type FAssocDefault :: k -> Type
type FAssocDefault @k = B @k
A.hs:21:23: error:
Unexpected type application @k
In the default declaration for ‘FAssocDefault’
|
21 | type FAssocDefault @k = B @k
|
So, what are the rules of the game? Let's fix this and document in the User's Guide.
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | RyanGlScott, goldfire, simonpj |
Operating system | |
Architecture |