Generic representation for lists reports incorrect fixity
Summary
The Metadata
reported for the list cons constructor (:)
get its fixity wrong.
Steps to reproduce
import GHC.Generics as G
ghci> :kind! G.Rep [Int]
G.Rep [Int] :: * -> *
= G.M1
D
('MetaData "[]" "GHC.Types" "ghc-prim" 'False)
(G.M1 C ('MetaCons "[]" 'PrefixI 'False) G.U1
G.:+: G.M1
C
('MetaCons ":" ('InfixI 'LeftAssociative 9) 'False)
(....
Expected behavior
I expect the constructor metadata to be
('MetaCons ":" ('InfixI 'RightAssociative 5) 'False)
That is, it should be right associative, with binding strength 5, not left associative with binding strength 9.
A pretty-printer isn't likely to use this info (since it will likely have special treatment for lists). A generic parser might do so, however, using something like listSyntax <|> genericParse
.
Environment
- GHC version used: 9.2
Optional:
- Operating System:
- System Architecture: