-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find a RULE that has a forall'd function called with a forall'd argument #169
Comments
…matically applying rewrites
It works and HERMIT can find the RULE just fine if I add explicit type annotations to it and make the types more specialized (and add a
But if I make the type annotation for
even though this should be a valid type. Also, GHC doesn't give any kind of error for this (just the warning from the original post), HERMIT just can't find the RULE with |
IIRC, GHC drops the rule when one of those warnings triggers, which is why HERMIT probably can't find it. Can you paste the warning? I've seen these before, but can't remember the details at this point. Is the type of grab: |
The warning is
(line 15 is the first line of the |
I'm surprised you weren't getting rigid type variable errors too with the way you wrote your third rule. I believe what you want is this:
|
To clarify my answer, every variable that shows up on the rhs of a rule has to appear on the lhs too, terms and types both. You can't have Making the type of |
Ideally, we would write the rule like this:
But the rewrite rule syntax does not allow for bound type variables outside of type ascriptions. Unless they added something with GHC 8 that I don't know about? |
@ecaustin It might be a little late for GHC 8, but maybe this would make a decent feature request? |
Does anyone have GHC 8 installed to test if your original version of the rule works or not? So maybe the type-checking of RULES is already fixed/addressed in GHC 8? |
If not I can set up a VM and look into this more this weekend. I've just been short on free time as of late. |
Typechecking of RULES appears to be unchanged in GHC 8.0. |
Well, I think I found a way to temporarily bypass the type checker in, hopefully, a relatively safe way to turn functions into endofunctions (of the form Maybe it's worth mentioning this restriction to the GHC devs though? |
I narrowed the error this down to this example
And I have a HERMIT session that looks like this:
The warning looks suspicious (I'm not sure I've seen it before), but I can get rid of it if I monomorphize the types (for example, if I make
f :: Int -> Int
andx :: Int
in the RULE definition). The same problem remains though, so the warning might be unrelated.I also notice that if I change the rule to
The warning goes away (and changes to a warning about
const
possibly inlining, which I think is ok) andrule-to-lemma grab-intro
works fine.I'm using GHC 7.10.3.
The text was updated successfully, but these errors were encountered: