Template haskell rejects duplicate instances before they're spliced
Suppose I want to see (from within ghci) how to write an instance declaration in the TH AST. I try:
Prelude> runQ $ [d| instance Monad Maybe where |] <interactive>:1:13: Duplicate instance declarations: instance Monad Maybe -- Defined at <interactive>:1:13-23 instance Monad Maybe -- Defined in Data.Maybe In the Template Haskell quotation [d| instance Monad Maybe where |] In the expression: [d| instance Monad Maybe where |] In the definition of `it': it = [d| instance Monad Maybe where |]
This seems ridiculous; I'm not trying to create an instance, just to create a TH AST fragment.