Prevent property duplication within a ruleset. #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
#6 resolved an issue with declaration ordering where the rendered order would not usually correspond to input order. This was achieved by using a writer instead of a record to collect declarations. A side effect of moving away from the record model is that a property can now appear more than once within a ruleset; but this should probably (continue to) yield a type error, hence this PR.
Design considerations
The
discard
function associated with theRule.do
syntax currently builds a tuple-list of properties as they are added to a ruleset. This is useful for ensuring that:@font-face
rules contain the minimum requiredfont-family
andsrc
descriptors; and@keyframe
block are animatable.The general idea was to use the same list of properties to prevent duplicates, but I couldn't think of a way to check for the absence of a property. On the other hand, the
Prim.Row.Lacks
type class does exactly this, given a row type of course. Therefore, the majority of the changes here involve migrating the list of properties from a tuple-list structure to a row type.Future plans
N/A
References
N/A
Code change checklist