Skip to content

Prevent property duplication within a ruleset. #7

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

Merged
merged 1 commit into from
Nov 5, 2022

Conversation

nsaunders
Copy link
Owner

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 the Rule.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 required font-family and src descriptors; and
  • all properties appearing within a @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

  • Any new or updated functionality includes corresponding unit test coverage.
  • I have verified code formatting, run the unit tests, and checked for any changes in the examples.
  • I have added an entry to the Unreleased section of the CHANGELOG.

@nsaunders nsaunders merged commit e4d2332 into master Nov 5, 2022
@nsaunders nsaunders added the enhancement New feature or request label Nov 6, 2022
@nsaunders nsaunders deleted the feature/prevent-duplicate-properties branch November 15, 2022 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant