Skip to content

Tracking ticket for improvements to TemplateHaskell

The purpose of this issue is to collect a list of (interdependent) tickets to track ways in which TemplateHaskell can be improved, for example to attract contributors at ZuriHac. At best, we end up with a kind of dependency graph between the tickets listed so that we can schedule tasks in parallel at ZuriHac. For now, I'll just try to collect issues.

Below list is the result of screening the issue range 24936-19816 (more to do before ZuriHac, I guess).

API stability of template-haskell (across GHC releases)

These have the highest and most immediate impact. If we can't solve stability, TH will be unattractive to users.

  • #24021 is the main tracking ticket. Most of the issues are now fixable independently of issues in the other categories, so I will not repeat them here.
  • One exception: #20828 seems like a good fit to map out at ZuriHac, because it invites discussion.

Splicing, Quoting, Lifting, TH AST and API parity

Good splicing and quoting go a long way towards providing a stable and enjoyable API.

  • #1800: Lifting the stage restriction
    • #21051: Stage restriction differs between typed and untyped TH
  • Language features missing in TH AST (and of course neither quotes or splices work either):
    • #24537: TH Quote support for RecordWildCards
    • #24455: Lazy field annotations
    • #24081: Cost-centre pragmas in expressions
    • Sized literals (e.g. [| 3#Int8 |])
    • #22122: TH can generate duplicate field names => chaos
    • #19816: SOURCE imported things shouldn't be allowed to be used in TH splices
  • Missing or broken splicing
    • #6089: Declaration splices are not permitted inside declaration brackets
    • #24781: Cannot splice function clauses (GHC proposal?)
    • #24009: TH Splices for Matches
    • #24922: Name should be splicable (GHC proposal needed)
    • #24936: Type splices in type and data decls (data $([t| T a |]) = ...)
    • #25435: Issues around declaration quotes produces LHS names
    • #25436: Declaration splices must be top-level
  • Missing quote syntax or broken desugaring for a couple of constructs
    • #24780: newcomer Constraint Quote desugaring should not need ConstraintKinds
    • #24757: TTH Quotes do not accept RequiredTypeArgs (interaction with -XImpredicativeTypes)
    • #24756: TTH Quotes do not accept TypeAbstraction (interaction with -XImpredicativeTypes)
    • #24572 (closed): TH Quotes decide what is a term and type arg when they should not
    • #24009: TH Quotes for Matches
    • #24801: Change in TemplateHaskellQuotes behavior in 9.10 w.r.t. UnboundVarE
    • #24797: No -Wbadly-staged-types warning for required type argument
    • #24793: Unbound 'z vs. [| z |] (needs design decision)
    • #22655: compiler crash TH + out-of-scope variable panic
    • #21794: Quote drops quantifiers in instance head
    • #20902: Missing namespace check for builtin syntax
    • #19893: CoreLint error due to existentials and levels
  • Missing Lift instances:
  • Quasiquotes:
    • #20862: GHC quotes as quasiquotes
    • #24966: Antiquotation/splices for quasiquotes
  • Missing API:

Reification

  • #21056: handling of invisible roles

GHC-internal refactorings

Ergnonomics: Warning, error messages, TH pretty-printing, documentation

  • #24650: Pattern quote should suggest to turn on -XTemplateHaskell
  • #24440: QuasiQuoters should be able to point errors to context
  • #24235: Lack of docs for getPackageRoot
  • #23705: Doc bug for makeRelativeToProject
  • #23197: Non-empty lists in some TH AST constructors
  • #22784 (closed): -ddump-splices omits required parentheses when printing explicit kind signature
  • #24894 (closed): -ddump-splices omits required parentheses when printing view patterns
  • #22757 newcomer
  • #24965 (closed) Allow banning (or warning on) implicit uses of lift

Bootstrapping, profiling, linking and cross compilation

  • #22069: Tracking ticket for using TH during GHC bootstrap
  • #24624: Build external interpreter with stage1 GHC (critical to unlock using TH in GHC itself and basically to all the issues listed below.)
  • #24731 (closed): Build external interpreter on-the-fly
  • #24395: Segfault when a profiled GHC compiles a (non-profiled?) TH splice
  • #24376 (closed): Support WASM backend (!12555 (merged))
  • #24339: execute Splices on the host (in practice depends on #24624)
  • #24886 (closed): Linker errors when running JS TH splices with undeclared deps
  • #20628: Load Haskell package libs with dynamically with system loader
  • #19021: Crash in GHC dynamic linker when invoking splice
  • #20617: TH linking/loading broken on aarch64

Misc

  • #23013 (closed): Fix recompilation avoidance for JS
  • #21220: Order of TH-added docs vs. user-added docs (open design question)
Edited by Teo Camarasu
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information