HerbiePlugin icon indicating copy to clipboard operation
HerbiePlugin copied to clipboard

Add option to ignore suggestions that require unsatisfiable constraints

Open ekmett opened this issue 10 years ago • 5 comments

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".

ekmett avatar Sep 22 '15 20:09 ekmett

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.

mikeizbicki avatar Sep 22 '15 21:09 mikeizbicki

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.

ekmett avatar Sep 22 '15 21:09 ekmett

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.

mikeizbicki avatar Sep 22 '15 22:09 mikeizbicki

Sure thing. I just went through and filed this stuff before I forgot about it. =)

ekmett avatar Sep 23 '15 02:09 ekmett

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.

mikeizbicki avatar Oct 01 '15 09:10 mikeizbicki