-
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
VariablePattern must be greater than 0 #32
Comments
Ach! That is very unfortunate. For -- | I x ~> x
rwi :: Rewrite a CLF
rwi = lhs := rhs
where
lhs = pat (App (pat I) "a")
rhs = "a" But I still think that is very crude. I think revisiting the API of patterns could be useful soon 👍. Thanks for reporting. To fix this we ought to do either or all of
In the meantime I'm keeping this open |
Accidentally closed while writing the comment. I've edit the response to its final form now. |
Ah, okay. I wasn't following the tutorial for figuring out how to write patterns, instead I was just following the API and the Haddocks :) Edit: And now I discovered that there is actually a haddock comment on the VariablePattern constructor which says "Should be a >0 positive number". 🤦 |
I was writing a simple set of rewrite rules for SKI combinatory logic, but I couldn't get the expressions to simplify.
Here is the code (simplified) that I used:
The definition of CL Terms:
The rewrite rule for
I x ~> x
:But this rewrite rule will not match, and it took me a while to figure out why: The arguments of VariablePattern have to start with 1, if I replace the rule with the following one:
Then everything works as expected.
The text was updated successfully, but these errors were encountered: