-
Notifications
You must be signed in to change notification settings - Fork 45
Factor class VariableName out of SortedVariable #1538
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
Factor class VariableName out of SortedVariable #1538
Conversation
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.
Although there are a lot of changes, they seem for the better, and code tends to look cleaner now. However, I'll let Virgil approve it, as I know he is more thorough in reviewing it.
|
There are a lot fewer changes after #1537 is merged. |
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.
Approving a draft feels a bit weird.
| instance Show Representation where | ||
| showsPrec prec (Representation typeRep1 _) = | ||
| showParen (prec >= 10) | ||
| $ showString "Representation " . shows typeRep1 . showString " _" |
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 kind of agree with this, but I'm curious: why didn't you add a Show a requirement besides the Ord one in Representation's definition above, and show the hashed here? Was it to make the output of showing a simplified term manageable?
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.
That's exactly it: I'm not sure it would be useful to show the condition, and it would dominate the output to the point that I'm afraid it wouldn't be useful.
| from = mkRepresentation | ||
| {-# INLINE from #-} | ||
|
|
||
| fromText :: Text -> Representation |
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.
Do we still need this?
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.
Nope!
Store the Condition (with its variable names mapped down to Variable) instead of the unparsed Condition. Using the dynamic representation in this way is Slightly Evil, but 50% faster.
Taking both the side condition and the configuration as arguments, instead of only a set of free variables, helps ensure that the rule variables are renamed to avoid both the configuration AND the side condition.
51c59cb to
4536334
Compare
After: #1537
This long-awaited refactoring of the
SortedVariableclass is necessary to (safely) state certain injectivity properties oftoVariable. That allows us to changeSideCondition.Representationin turn, yielding a 46% speed-up of thesum-to-nproof.See also: #1399
Fixes: #1472
Reviewer checklist
stack test --coveragestack haddock