-
Notifications
You must be signed in to change notification settings - Fork 48
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
Use simplifying constructor for PEq #545
Conversation
The idea is to always normalize Prop equalities such that concrete values appear on the left-hand-side. This follows the example of the helper functions for expressions, that also immediately simplify if they get concrete arguments, and normalize arguments for commutative operations.
@@ -432,6 +432,14 @@ data Prop where | |||
PBool :: Bool -> Prop | |||
deriving instance (Show Prop) | |||
|
|||
mkPEq :: (Typeable a) => Expr a -> Expr a -> Prop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what would be the best name.
I originally had peq
, to follow the example of the helper functions for Expr
, but I don't like that very much. I think that mkPEq
better conveys what the function is doing. We could also use full makePEq
.
@msooseth, opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like a good name to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think traversals should not change things. Otherwise it's actually really good! I also checked, and you left no PEq constructor untouched :)
@@ -432,6 +432,14 @@ data Prop where | |||
PBool :: Bool -> Prop | |||
deriving instance (Show Prop) | |||
|
|||
mkPEq :: (Typeable a) => Expr a -> Expr a -> Prop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like a good name to me.
OK, merging. Let's make sure to add a CHANGELOG entry next time, though! Also, we should add a fuzz test for this as well as the Expr LHS/RHS ;) |
Thanks so much! Really good stuff! We should have done this ages ago! |
Description
The idea is to always normalize Prop equalities such that concrete values appear on the left-hand-side.
This follows the example of the helper functions for expressions, that also immediately simplify if they get concrete arguments, and normalize arguments for commutative operations.
Checklist