HerbiePlugin
HerbiePlugin copied to clipboard
Add option to ignore suggestions that require unsatisfiable constraints
I have a lot of code that often can't incur the extra Ord constraints and the like that would be required to satisfy herbie. e.g. it currently works over Complex numbers or other cases that aren't Ord.
It'd be nice to have the option to be able to filter out suggestions that don't apply in the "context as written".
I think what you're suggesting is that given a function f, Herbie might want to rewrite it to something that incurs an Ord constraint (which you can't add), and you want to force Herbie to only search for solutions that don't have Ord constraints. If so, that's not something that the Herbie backend currently supports. But I'll definitely pass these suggestions on to them and see how easy they'd be to implement.
Right now in Herbie/CoreManip.hs you have a WARNING: you show that says you can't satisfy the constraint and that you won't be applying the rewrite. I'm mostly just looking to see if that can suppress the entire suggestion with a flag or a module annotation.
If I'm going to start incorporating herbie into my day-to-day workflow things like that 'd be nice to have.
Sure, I can add a few options to toggle things like this. I'll probably wait a few days to collect feedback from people about what options would be useful before adding them.
Sure thing. I just went through and filed this stuff before I forgot about it. =)
You can now pass the flag -fplugin-opt=Herbie:noRewrite to prevent the plugin from performing rewrites. This will eliminate all the warnings, but there's still no option within the Herbie program to selectively disable certain transformations, like those that require the Ord constraint.