Follow-up from "Fix TH dependencies (#22229)" to refactor TH module structure
In !12456 (comment 560335), @clyring proposed the following refactoring (nearly; I slightly changed the module names involved to use the TH.Internal.*
namespace instead of TH.Lib.*
)
flowchart TD
subgraph A[Language.Haskell.TH.Syntax]
P[A bunch of re-exports]
end
subgraph B[Language.Haskell.TH.Internal.Lift]
Q[The Lift typeclass]
R[Various Lift instances]
P --> R
P --> Q
R --> Q
end
subgraph C[Language.Haskell.TH.Internal.Lib]
S[A bunch of stuff used in TemplateHaskellQuotes desugaring]
U[The Quote typeclass]
U -. co-located with (referring to Note [Tracking dependencies on primitives]) .- S
Q --> U
P --> U
end
subgraph D[Language.Haskell.TH.Internal.Syntax]
T[The main template-haskell AST types]
P --> T
Q --> T
R --> T
S --> T
U --> T
end
A -- imports --> B
B -- imports --> C
C -- imports --> D
The reason for this refactoring is that currently, we declare any use that imports Language.Haskell.TH.Lib.*
but not Language.Haskell.TH.Syntax
as unsupported, which is an unnecessary pitfall that would be fixed by the proposed refactoring.