As detailed in #622, compile-time codegen is not a viable path forward for Cabal or Bazel projects. However, we can take advantage of the fact that we can run Template Haskell splices in the IO monad, with some elbow grease, then pretty-print the resulting TH declarations, piping the result through ormolu. We’ll run this executable every time we bump the grammars, which will lead to much better compile-time caching.
As always, massive props to @aymannadeem for the TH codegen work: there’s absolutely no way this would have been feasible without being able to piggyback on that work.
Stuff left to do:
[x] Regenerate all the grammars
[x] Provide a script that does step 1 automatically.
As detailed in #622, compile-time codegen is not a viable path forward for Cabal or Bazel projects. However, we can take advantage of the fact that we can run Template Haskell splices in the
IO
monad, with some elbow grease, then pretty-print the resulting TH declarations, piping the result throughormolu
. We’ll run this executable every time we bump the grammars, which will lead to much better compile-time caching.To test:
As always, massive props to @aymannadeem for the TH codegen work: there’s absolutely no way this would have been feasible without being able to piggyback on that work.
Stuff left to do: