Skip to content

Rewrite rules #660

@paf31

Description

@paf31

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!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions