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

not selector cannot be applied to a refinement #239

Open
Skyfold opened this issue Jun 2, 2022 · 2 comments
Open

not selector cannot be applied to a refinement #239

Skyfold opened this issue Jun 2, 2022 · 2 comments

Comments

@Skyfold
Copy link

Skyfold commented Jun 2, 2022

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
Copy link
Collaborator

turion commented Jun 4, 2022

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
Copy link
Collaborator

turion commented Jun 4, 2022

Feel free to send a PR if you want :)

Skyfold pushed a commit to Skyfold/clay that referenced this issue Jun 8, 2022
Skyfold pushed a commit to Skyfold/clay that referenced this issue Jun 8, 2022
Skyfold added a commit to Skyfold/clay that referenced this issue Jun 8, 2022
Skyfold added a commit to Skyfold/clay that referenced this issue Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants