-
Notifications
You must be signed in to change notification settings - Fork 153
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 new collection predicates: Contains, Index, and Unique #6
Comments
For ordered collections, we could also have a |
Good idea, @jgpacker ! We could have |
Another collection predicate: |
|
|
Hi, @fthomas :) I want to Implement |
@sh0hei The idea of Usage would look something like this: type UniqueList[A] = List[A] Refined Unique
scala> RefType.applyRef[UniqueList[Int]](List(1, 2, 3))
res0: Either[String, UniqueList[Int]]= Right(Refined(List(1, 2, 3)))
scala>RefType.applyRef[UniqueList[Int]](List(1, 2, 2))
res1: Either[String, UniqueList[Int]]= Left("Predicate failed: List(1, 2, 2) contains duplicated elements: 2") |
okay :) |
Awesome! :-) |
@fthomas Excuse me, I'd like also to know about Usage |
@sh0hei |
Closing since most of the predicates in this ticket are now implemented. |
Hey, what's the status on |
@kubukoz It hasn't been implemented yet. :) But I'm open to adding |
Contains
is just a type alias (Contains[A] = Exists[Equal[A]]
),Index[N, P]
checks if the value at indexN
satisfies the predicateP
, andUnique
checks if all elements in a collection are unique.The text was updated successfully, but these errors were encountered: