-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
That's a kinda tricky thing to do...
From "obvious" steps we can take:
-
Mark types & predicates as
:seq,:numand:stringand converge the predicates tree to the most "common" one. In case of mismatch show the error -
For ordering predicates, we can do basic checks with
:numtypes using simple rules to deal with intervals -
Anything else...?
A few example of what I want to "catch":
(r/refined s/Str (r/Greater 0))
(r/refined [s/Str] (r/First (r/Greater 0)))
(r/And (r/Greater 0) r/NonEmpty))
(r/refined (r/refined [s/Str] r/NonEmpty) (r/Greater 0))
(r/refined (r/NonEmptyListOf s/Str) (r/First (r/Greater 0)))More on "dependent types":
(r/And (r/Greater 0) (r/Less 0)) ;; (r/Equal 0)
(r/And (r/Greater 0) (r/Less -1)) ;; error
(r/Or (r/Greater 0) (r/Greater 10)) ;; (r/Greater 0)
(r/refined NonEmptyStr NonEmpty) ;; NonEmptyStrNeat and very nice to have:
(r/refined [s/Str] (Less 0)) ;; error suggesting to use (On count (Less 0))
(r/refined [s/Str] (On count NonEmpty)) ;; error becuase `count` returns to numeric
(r/refined double (On count NonEmpty)) ;; error becuase `count` does not accept double