Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#10486 closed feature request (fixed)

Allow addTopDecls to create annotations

Reported by: spinda Owned by: spinda
Priority: normal Milestone: 8.0.1
Component: Template Haskell Version: 7.10.1
Keywords: Cc: gridaphobe
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: testsuite/tests/annotations/should_compile/th/
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D1201
Wiki Page:


Currently addTopDecls is restricted to creating function, value, and foreign import declarations. Lifting this restriction allows one to create annotations without any issues, as far as I can tell.

Change History (8)

comment:1 Changed 5 years ago by gridaphobe

Cc: gridaphobe added

comment:2 Changed 4 years ago by spinda

I can submit a patch for this if the idea is okay. It's a very trivial change.

comment:3 Changed 4 years ago by spinda

Differential Rev(s): Phab:D1201
Owner: set to spinda
Test Case: testsuite/tests/annotations/should_compile/th/

comment:4 Changed 4 years ago by Ben Gamari <ben@…>

In ba5554ec/ghc:

Allow annotations though addTopDecls (#10486)

addTopDecls restricts what declarations it can be used to add. Adding
annotations via this method works fine with no special changes apart
from adding AnnD to the declaration whitelist.

Test Plan: validate

Reviewers: austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10486

comment:5 Changed 4 years ago by bgamari

Resolution: fixed
Status: newclosed

comment:6 Changed 4 years ago by simonpj

Michael (@spinda), where in the user manual or TH library Haddock documentation is this change documented?

Maybe the documentation of addTopDecls is lacking... if so, might you add some? Thanks!


comment:7 Changed 4 years ago by goldfire

See #10853, a new ticket meant to track general improvements to addTopDecls.

comment:8 Changed 4 years ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.