Currently categorify runs in CategoryStack, which doesn't include CoreM. This is because categorify is used as a rewrite rule, and the type of ru_try doesn't permit using CoreM.
This means we can't do CoreM things in it, like findId.
It should be possible to use categorify to modify the CoreProgram directly (see bindsOnlyPass), i.e., we just look for applications of Categorifier.Categorify.expression and rewrite them. This way it can run in CoreM, giving us more flexibility.
Currently
categorifyruns inCategoryStack, which doesn't includeCoreM. This is becausecategorifyis used as a rewrite rule, and the type ofru_trydoesn't permit usingCoreM.This means we can't do
CoreMthings in it, likefindId.It should be possible to use
categorifyto modify theCoreProgramdirectly (see bindsOnlyPass), i.e., we just look for applications ofCategorifier.Categorify.expressionand rewrite them. This way it can run inCoreM, giving us more flexibility.