Support for TH declaration quotes

These patches implement the proposal #283. I didn't implement @fumieval's suggestion of automatically generating instances because it seemed orthogonal to this one (at least implementation-wise).