A slightly different idea for how to implement rewrite rules, which would be more flexible:
- Provide a PureScript library which contains a type for the core AST, and some simple functions for generic traversals in the style of
syb.
- Developers have the option of including a
.rewrites.purs file for each module, which contains a top level value rewrites :: [Tuple Priority (AST -> AST)], which is compiled and interpreted using Node during compilation.
psc is responsible for interacting with the Node process, and passing the core AST back and forth during optimization.
This way, we don't need any special syntax for rewrites in the source code itself. We could even support the optimizations for runST!
A slightly different idea for how to implement rewrite rules, which would be more flexible:
syb..rewrites.pursfile for each module, which contains a top level valuerewrites :: [Tuple Priority (AST -> AST)], which is compiled and interpreted using Node during compilation.pscis responsible for interacting with the Node process, and passing the core AST back and forth during optimization.This way, we don't need any special syntax for rewrites in the source code itself. We could even support the optimizations for
runST!