-
Notifications
You must be signed in to change notification settings - Fork 154
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
Draft macroless ==> #758
base: master
Are you sure you want to change the base?
Draft macroless ==> #758
Conversation
I have this passing[*] validateJVM locally, but it has to build against a version of singleton-ops with fthomas/singleton-ops#134, I'm using a publishLocal against head of master. [*] a few things are disabled |
I applause the macroless One quick question: Is |
@fthomas that's right, I only implemented |
Probably obvious from the PR diff, and my comments, but worth calling out that this does add |
My thoughts with regards to WDYT, @erikerlandson? |
@fthomas I have no use cases that would need the The role of expressing predicate constraints on literal types is arguably the domain of singleton-ops, using forms like |
just as a use-case reference, here is how I'm applying |
@fthomas I removed RefinedLT and equalValidateInference. There were two impacts.
property("Exists[A] ==> Exists[B]") = secure {
Inference[Contains[W.`'5'`.T], Exists[Digit]].isValid
}
val a: Char Refined Equal[W.`'0'`.T] = '0'
val b: Char Refined Digit = a |
f198171
to
e54a777
Compare
A candidate fix for #755 that refactors
==>
to be macroless: if a valid inference cannot be proven, thenP1 ==> P2
will fail to manifest. It no longer has a boolean field that is checked via macro.Introduces a compile-time version of
Refined
calledRefinedLT
, which tests a literal typeL
's value against a corresponding predicateP
. So the use of macros has been pushed from==>
toRefinedLT
, where the macros are used to extract literal-type value and run the validator against it.This PR is currently a bit rough - a few unit tests are failing, or failing to compile, which appear to work OK when I run them in the REPL. I also hacked around the old
.isValid
based unit-testing using a shim that made kittens cry.