This is why we need typed DSL in Python:
Manipulating such an IR is error-prone, as it is easy to con- struct nonsensical terms such as App(Const(1),Const(2)).
How to get quasiquotes in Python?
- Custom string prefixes in Python, like quasiquotes: https://mail.python.org/pipermail/python-ideas/2013-May/020919.html
- Or make your own encoder? https://stackoverflow.com/a/37204095
- Maybe just make the repper forms of real Python functions? i.e.
But the issue is you also need to store the types at runtime and the regular types aren't good at this...
- "Lift" function of
Rep[T] -> Rep[V]to
Rep[T -> V]