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

Add type-level Equals for Boolean #66

Closed

Conversation

JordanMartinez
Copy link
Contributor

Fixes #65

@hdgarrood
Copy link
Contributor

I’m wary of adding things before we have a concrete use case for them. Is that the case here?

@JordanMartinez
Copy link
Contributor Author

I don't have a good case in mind. I believe this would be required if one ever created a type-level list of booleans and wanted to find an element within that list. But I can't think of a scenario where one would want to do that at the type-level.

@JordanMartinez
Copy link
Contributor Author

@kl0tl Since you originally suggested this, do you have any concrete use cases in mind?

@kl0tl
Copy link
Member

kl0tl commented Nov 27, 2020

I did not propose this class with a specific use case in mind, but I guess it would be needed to implement the characteristic function of a relation that holds either when it does or fails for all its premises (but not when it fails only for some of them). For example with type-level routes you may need this to know if all routes in a set of alternatives are either auth protected or unprotected.

Without some boolean equality we can only express the characteristic function of relations that hold when they do for all (with And) or any (with Or) of their premises. The same line of reasoning would support also adding xor and logical implication.

I’m fine waiting for concrete use cases though, this is easy enough to implement elsewhere if needed in the meantime.

@JordanMartinez
Copy link
Contributor Author

We could leave this PR open until such a use case emerges and then merge this PR and make a release pretty trivially, right? However, I'm not sure I'd want an open PR on a repo that may never get merged. So, should this actually be closed instead?

@hdgarrood
Copy link
Contributor

I’d rather close this than leaving it open for merging at some unspecified future date, yeah. The PR will still be there if someone looks at the list of closed PRs.

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

Successfully merging this pull request may close these issues.

Add Equals to Type.Data.Boolean?
3 participants