Skip to content
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

Adds Not type class, Fixes #239 #240

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Conversation

Skyfold
Copy link
Contributor

@Skyfold Skyfold commented Jun 8, 2022

The not pseudo selector can only be applied to one argument at a time in most browsers, Safari seems to be the exception. The instance for Not Refinement allows you to apply Not to multiple arguments, however, there is no contaminator to combine two Refinement directly.

Copy link
Collaborator

@turion turion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is looking great :) can you add two simple unit tests using each instance?

@Skyfold
Copy link
Contributor Author

Skyfold commented Jun 28, 2022

I've added four simple tests in PseudoSpec.hs

There is one disadvantage to the current type class approach: if you write not ".test" it is ambiguous if the ".test" is a Selector or a Refinement.

@turion
Copy link
Collaborator

turion commented Jun 29, 2022

Yes, that's a disadvantage. Recently, a similar issue was raised: #241

Copy link

This issue has not seen any activity in a long time. If no further activity occurs, it will be closed after ten weeks.

Copy link
Collaborator

@turion turion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR is still a useful addition!

src/Clay/Render.hs Outdated Show resolved Hide resolved
@turion turion linked an issue Oct 24, 2024 that may be closed by this pull request
@turion turion merged commit 7f646d4 into sebastiaanvisser:master Oct 24, 2024
10 checks passed
@chungyc
Copy link
Contributor

chungyc commented Oct 31, 2024

FYI, this can break existing code when the type for the selector is not explicit. For example,

img # (not ".keep-colors" <> "src" $= ".svg")

will now result in an ambiguous type.

This is not a big deal for me (I plan to simply add an explicit type annotation), but it should at least be mentioned in any release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

not selector cannot be applied to a refinement
3 participants