sebastiaanvisser / clay

A CSS preprocessor as embedded Haskell.
Other
360 stars 73 forks source link

Adds Not type class, Fixes #239 #240

Closed Skyfold closed 1 month ago

Skyfold commented 2 years ago

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.

Skyfold commented 2 years ago

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 commented 2 years ago

Yes, that's a disadvantage. Recently, a similar issue was raised: https://github.com/sebastiaanvisser/clay/issues/241

github-actions[bot] commented 1 month ago

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

chungyc commented 3 weeks ago

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.