sebastiaanvisser / clay

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

not selector cannot be applied to a refinement #239

Closed Skyfold closed 1 month ago

Skyfold commented 2 years ago

The not selector can be applied to a selector :not(p) or to a refinement input:not(:checked), however the type signature for not is not :: Selector -> Refinement.

What I need is effectively not :: Either Selector Refinement -> Refinement, though it would not be nice to write input # not (Left checked). Ideally, I would like to write not p and input # not checked.

How would you like this implemented?

turion commented 2 years ago

Thanks for pointing this out!

The typical clay style for this is to create a new type class:

class Not a where
  not :: a -> Refinement

instance Not Selector where
...
instance Not Refinement where
...

So rather an open sum than a closed sum.

turion commented 2 years ago

Feel free to send a PR if you want :)

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.

turion commented 1 month ago

Thanks!