Skip to content

Parse error when annotating type-class instance functions.

Summary

Please read the guidance in [https://gitlab.haskell.org/ghc/ghc/-/wikis/report-a-bug] and write a brief description of the issue.

Steps to reproduce

Code:

instance Show Foo where
  {-# ANN show "hi" #-}
  show _ = "Foo" 

Parse error:

ann.hs:2:3: error: parse error on input ‘{-# ANN’
  |
2 |   {-# ANN show "hi" #-}
  |   ^^^^^^^

Expected behavior

Succesful parse

Environment

  • GHC version used: 9.2.8 and 9.7.20230505

Optional:

  • Operating System: NixOS
  • System Architecture: x86_64-linux
Edited by syd@cs-syd.eu
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information